0
나는 대부분의 사람들이 링크하는 것처럼 보이는 brad wilson 게시물을 포함하여 EF의 복잡한 유형을 다루는 방법에 대한 다양한 블로그 게시물을 읽었습니다. 나는 정말로 그것을 얻지 않는다. EF 코드의 첫 번째 개발, MVC 및 VB 사용하고 있습니다. 복잡한 유형의 편집기 필드를 렌더링하기 위해 지금까지 읽은 것부터 사용자 정의 객체가 필요합니다. 맞습니까? 그러나 나는 정말로 내가 사용자 정의 템플릿에 넣어야 할 코드를 이해하지 못한다. 누군가가 PostTags icollection에 대한 텍스트 상자를 렌더링 할 수 있도록 코드가 사용자 정의 템플렛으로 들어가야 할 필요가 있는지에 관해서는 나에게 부숴 먹을 수 있습니까?복잡한 유형의 텍스트 상자 렌더링?
내 클래스 :
Public Class Post
Inherits EntityBase
<Key()> Property PostId As Integer
<DisplayName("Title")> <Required()> Property PostTitle As String
<UIHint("MultilineText")> <DisplayName("Text")> Property PostText As String
ReadOnly Property PostExcerpt As String
Get
If PostText.Length > 100 Then
Return Helpers.TruncateHelper.TruncateAtWord(PostText, 250)
Else : Return PostText
End If
End Get
End Property
<ScaffoldColumn(False)> Property PostDateCreated As DateTime
<ScaffoldColumn(False)> Property PostDateModified As DateTime?
<ScaffoldColumn(False)> Property PostDatePublished As DateTime?
<DisplayName("Publish?")> Property PostIsPublished As Boolean
<DisplayName("Allow Comments?")> Property CommentsAllowed As Boolean
<ScaffoldColumn(False)> Property CategoryId As Integer?
<UIHint("Text")> <DisplayName("Category")> <Required()> Property PostCategory As String
Property Comments As IList(Of Comment)
'Post has collection of Tags
<DisplayName("Tags (comma separated)")> Overridable Property PostTags As ICollection(Of Tag)
End Class
Public Class Tag
Dim _rdsqlconn As RDSQLConn
<Key()> Property TagId As Int32
Property PostId As Int32
Property TagWord As String
'Overridable property to access Post
Overridable Property Post As Post
End Class