c# - Function Call inside IQueryable's Select Anonymous object -
i have following code:
expression<func<int, string>> mystatuscode = (t) => pluginapplication.types.totypename(t); var model =_context.usersrepository.include("emails").include("website"). include("userdetail").include("profile").asexpandable().where(t => t.typeid == (usertype)10017).select(t=> new { userid = t.userid, username = t.username, chatname = t.chatname, email = t.emails.firstordefault(z => z.typeid == emailtype.main).emailaddress, lastlogindate = t.lastlogindate, statusid = t.statusid, website = t.signeduponwebsite.shortname, statuscode = mystatuscode.invoke((int)t.statusid) });
here i'm using linqkit seems me call method when select data without take expresion asenumerable.if put tolist or asenumerable , work well, don't wanna this.i want find avoid error :
linq entities not recognize method'pluginapplication.types.totypename (system.int32)' method, , method cannot translated store expression.
Comments
Post a Comment