c# - Passing objects in the linq statement -


i using following linq statement in web api using entity framework. working fine except in linq statement dont know how pass icollection

public class projoverview {      public int proj_id { get; set; }     public string name { get; set; }     public virtual icollection<p_type> p_type { get; set; }    } 

and linq statement

   var pover= (from c in db.pr_d                                select new pover                                {                                    name=c.proj.name,                                    proj_id=c.proj.p_id,                                    p_type= icollection<c.proj.pro_type>                                   }).take(7);                 return pover; 

i intellisense error on " p_type= icollection" saying type used variable. please let me know how fix it. thank

the error message should helpful, setting p_type type (icollection<t>) instead of variable, need change this:

   var pover = (from c in db.pr_d                          select new projoverview                            {                                name=c.proj.name,                                proj_id=c.proj.p_id,                                p_type= c.p_type_variable                               }).take(7);    return pover; 

i've noticed used pover class name, maybe meant use projoverview?


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -