c# - Linq -- How to perform Join in ForEach statement? -
the linq join examples i've seen illustrate hot ti join when creating anonymous type. how do the join in foreach statement.
e.g.
foreach (item in mycontext.someentity.include("navigationproperty1").include("navigationproperty2").join(mycontext.someentity2 on id == id) { } thanks!
well, you're trying mix query syntax calling extension methods directly here - that's not going work start with.
but result of join sequence of pairs, - pairs have property in common. it's not clear "item" comes - how want each pair someentity , someentity2 transformed item?
your call end looking like:
...join(mycontext.someentity2, x => x.id, y => y.id, (x, y) => !!!) where !!! projection pair of entities single useful value.
see part 19 of edulinq blog series more information how join method works.
Comments
Post a Comment