Can someone help me to translate this
var query = from s in context.ShoppingMalls
join h in context.Houses
on
new { s.CouncilCode, s.PostCode }
equals
new { h.CouncilCode, h.PostCode }
select s;
into lambda query?
Thanks.
var query = context.ShoppingMalls
.Join(
context.Houses,
s => new { s.CouncilCode, s.PostCode },
h => new { h.CouncilCode, h.PostCode },
(s, h) => s);
Although the example and answer given by @Thomas Levesque works for columns that match, I wanted to also supply the answer if you have columns to join on but they have different names. This is what I needed for my googling and this question got me close.
The difference of course is the explicit declaration of the columns as a variable to identify on.
var query = context.MapKitsToResources
.Join(
context.Resources,
o => new { Id = o.ResourceId, Type = o.ResourceTypeId},
i => new { Id = i.Id, Type = TypeId},
(o, i) = new { rType : i };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With