c# - LINQ Type arguments cannot be inferred -
i have 2 objects want join _locations
, lrslocations
. want update _locations
attributes corresponding lrslocations
. using linq references both options , going through , updating ms2
attributes lrs
(i know isn't linq made open new ideas. using linq query now:
var joinresult = ms2 in _locations lrs in lrslocations ms2.lrs_id == lrs.attributes.route_id && ms2.lrs_loc_pt == lrs.attributes.measure select new {ms2, lrs};
it works need left outer join
after googling attempting:
var joinresult = ms2 in _locations join lrs in lrslocations on new { ms2.lrs_id, ms2.lrs_loc_pt } equals new { lrs.attributes.route_id, lrs.attributes.measure } merge lrs in merge.defaultifempty() select new { ms2, lrs };
the issue join lrs
complains: http://i.imgur.com/5eaefmx.png (click picture)
so either need way convert working linq left outer join, or understand problem talking in new one, because google didn't give me insight.
the anonymous types in join must have same property names:
join lrs in lrslocations on new { ms2.lrs_id, ms2.lrs_loc_pt } equals new { lrs_id = lrs.attributes.route_id, lrs_loc_pt = lrs.attributes.measure }
obviously types have match well. if don't need conversion or cast.
Comments
Post a Comment