我有两个相关的简单视图模型。我可以通过 linq include 语句查询数据,但是当我将其注入视图模型时,icollection 什么都不是?
视图模型:
Public Class EventViewModel
Public Property EVENTID As Integer
Public Property TITLE As String
Public Overridable Property USERS() As ICollection(Of UserViewmodel)
End Class
Public Class UserViewModel
Public Property USERID As Integer
Public Property EVENTID As Integer
Public Property NAME As String
End Class
询问:
Dim dataObject As EVENTTABLE = db.EVENTTABLE.Include("USERTABLE").Single(Function(c) c.EVENTID= "1")
用户在对象中!
注射:
viewModel.InjectFrom(dataObject)
用户什么都不是?