I'm using linq2db ORM in my project and have the following database schema (simplified):
I have the following method to get information about the user:
public async Task<User> GetUser(int id)
{
var user =
await (
from u in _db.Users
.LoadWith(u => u.Accounts)
.ThenLoad(a => a.Transactions)
where u.Id == id
from lang in _db.Languages.LeftJoin(l => l.Id == u.LanguageId)
select u)
.FirstOrDefaultAsync();
return user;
}
However, I wanted to get the information about all the limits and aggregators for each account. I believe there should be an efficient way to do that. Could someone help me with that?