EntityFramework Code First, is it possible to map this -
is there possibility map 1 entity ?
select x,y,z, (select count(*) othertable tableid=table.id) othertablecount table t
i want map class looks this:
public class stuff { public string x { get; set; } public string y { get; set; } public string z { get; set; } public int count { get; set; } }
no. should map collection , use projection querying:
class stuff { ... public virtual icollection<otherstuff> { get; set; } } var stuffwithcount = stuff in mycontext.stuff select new { stuff.x, ... count = stuff.otherstuff.count() };
Comments
Post a Comment