这是我拥有的实体...
Public Class Account
Public Property AccountId As integer
Public Property AccountDescription As String
Public Property Transactions As List(Of Transaction)
End Class
Public Class Transaction
Public Property TransactionId As Integer
Public Property AccountId As Integer
Public Property TransactionDescription As String
End Class
我想让它成功,例如,当我执行“db.Account.find(1)”时,它也会加载到具有对应 AccountId 的所有交易的列表中。我不太确定这是什么类型的关系??无论如何,现在我可以做到
Dim acct As Account = db.Account.Find(1)
acct.Transactions = from ts in db.transactions select ts where ts.AccountId = acct.accountid
但是我知道这不是正确的方法,必须有一种方法可以将其映射出来,以便实体可以一次性加载所有内容,对吗?谢谢你的帮助。