linq to entities - How to create a Store Expression for entity framework -


i have this.

var viewmodel = repgeneric.getlistof<companycontact>(p => p.companyid == 1).select(s => new contactviewmodel()             {                 contacttype = _db.contacttypetexts.firstordefault(p => p.id == s.contact.contacttype.id).txt             }); 

i put piece of code

_db.contacttypetexts.firstordefault(p => p.id == s.contact.contacttype.id).txt

in function.
how can that.? idea. try that's give me error :

linq entities not recognize method 'system.string gettxt()' method, , method cannot translated store expression.

thanks

try model-defined function described in this blog article julie lerman.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -