In my model, I have a User
aggregate root, each of which has a collection of associated Transactions
. Each Transaction
has a reverse navigation property User
.
I need to get all of the Transactions
at once, and this has resulted in the following query in my UserRepository
public ICollection<ITransaction> GetAllTransactions() {
return (from u in Set.Include("Transactions")
from t in u.Transactions
select t).ToList();
}
Set
is IDbSet<User>
from the EF context.
The problem is that lazy-loading is not implemented (nor do I want to implement it) and the Transaction.User
property after querying is null
. Everything is mapped through EF correctly.
What should the query be to retrieve all Transactions
with a non-null User
?
I am using EF6.