这些是我的实体...
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 TransferAccountId As Integer
Public Property TransactionDescription As String
End Class
我现在知道我可以做到这一点。db.Account.Include("Transactions").SingleOrDefault(Function(a) a.AccountId = myAccountId)
但是,这只包括显然具有 AccountId = myAccountId 的交易。但就我而言,我想要所有交易,包括那些涉及转移的交易。所以其中 AccountId = AccountId 或 TransferAccountId = myAccountId。我如何在一次调用中加载一个帐户及其交易和转账交易列表?