저는 실제 문제가 있습니다. 그 이유는 충분히 알지 못하기 때문입니다. 나는 약 50 개의 기사를 검색하여 답을 찾을 수 없다. 여기 MVC 3 ViewModel 메서드 모델 만들기
는 여기Namespace Models
Public Class Article
Public Property ArticleId As Integer
Public Property Author As String
<DisplayFormat(DataFormatString:="{0:D}")>
Public Property CreatedOn As DateTime
<DisplayFormat(DataFormatString:="{0:D}")>
Public Property LastModified As DateTime
<AllowHtml()>
Public Property Content As String
Public Property Title As String
Public Property Excerpt As String
Public Property IsPublic As Boolean
Public Overridable Property Category As ICollection(Of Category)
Public Overridable Property Tags As ICollection(Of Tag)
Public Overridable Property Status As ICollection(Of Status)
Public Overridable Property Comments As ICollection(Of Comment)
End Class
End Namespace
Namespace Models
Public Class Status
Public Property StatusId As Integer
Public Property Name As String
Public Overridable Property Articles As ICollection(Of Article)
End Class
End Namespace
Namespace Models
Public Class Category
Public Property CategoryId As Integer
Public Property Name As String
Public Overridable Property Articles As ICollection(Of Article)
End Class
End Namespace
Namespace Models
Public Class Tag
Public Property TagId As Integer
Public Property Name As String
Public Overridable Property Articles As ICollection(Of Article)
End Class
End Namespace
내 ViewModel에있다가 (내 도메인 모델을 기반으로) 내 도메인 모델 나는 패턴을 교차 이러한 모든 데이터와 함께 저장하는 방법을 잘 모릅니다
Namespace ViewModels.Admin
Public Class ArticleViewModel
Public Property Article As Article
Public Property CategoryId As Integer
Public Property StatusId As Integer
Public Property Tags As ICollection(Of Tag)
End Class
End Namespace
있습니다. 나는 지금 많은 방법을 시도해 보았고 어디를보아야할지 모른다. 나는 몇 권의 책을 시험해 보았지만 아무도 이것을 정말로 파헤 쳤다. 또한 Contoso University 프로젝트를 살펴 보았지만 내 프로젝트처럼 보이지 않습니다. 누구든지 도와 줄 수 있습니까?
에? – smartcaveman
도움이된다면 아래의 내 의견을 참조하십시오. EF 코드 첫 번째 모델을 통해 데이터베이스에 저장하고 있습니다. – Chuck