Reputation: 52922
I want to use chained linq. I am having some trouble with the syntax.
select * from APPLES
inner join BANANAS on APPLES.id = BANANAS.someid
I have:
var result = workspace.GetDataSource<APPLE>().Join(.......)
but I am unsure about what goes into the Join bit. Could someone help me out?
Upvotes: 0
Views: 133
Reputation: 942
How about:
var result = from a in workspace.GetDataSource<APPLE>()
from b in workspace.GetDataSource<BANANAS>()
where a.id == b.someid
select a;
or if you want to use join notation:
var result = from a in workspace.GetDataSource<APPLE>()
join b in workspace.GetDataSource<BANANAS>()
on a.id equals b.someid
select a;
Note, you can change the select a to a projection of the elements you need from both tables.
Not as familiar with this format, but it would be something like this:
var result = workspace.GetDataSource<APPLE>().Join(workspace.GetDataSource<BANANAS>(),a=>a.id, b=>b.someid,(a,b) => a);
Upvotes: 4