odata - Linq & Entityframework, ISNull and getting a single value from a join -
i'm trying replicate next sql query in linq:
select l.*, isnull( i.interestpercentage,0) interestpercentage properties l left bring together involvement on i.listingkey = l.listingkey i.userid = {0}
i don't have much go @ moment:
var results = l in context.properties bring together s in context.interest on l.listingkey equals s.listingkey s.userid == "";
this returns me total join, i'd homecoming properties single additional value, interestpercentage
. think might need create new object columns of properties additional property of interestpercentage. add together select new myobject { tons of property setters }
.
additionally though, i'm trying expose via odata, lose queryable ability doing this?
you can seek return
new {mainobj = l, interestpercentage = (your calculated field)}
or create object have similar construction above. help avoid property setting.
linq odata entity-framework-4.3
No comments:
Post a Comment