這是我的實體...實體框架(裝入嵌套實體)
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。我如何在一次通話中加載賬戶及其交易和轉賬交易清單?