I have 3 tables: main account, activities & trades.
What I want is to return a bool, based on wither or not a main account has any trades associated with it (connect via an account id column in main account table).
I'm able to tie back the main account and it's associated activities with the following linq query:
From ma in context.MainAccounts
From ac in context.Activities.where(ac => ac.AccountId == ma.AccountId
Select new MainAccountDto{
}
However, I'm struggling to workout how I can set a HasTrades column on my dto object.
I'm not wanting any data from the activities table, just if there are any activities. Would someone be able to please point me in the right direction?
MainAccount.Activities. Don't join manually, as you and the answers (so far) do. Then it's simplyHasTrades = ma.Activities.Any().