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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -