c# - Custom functions on data Selected from IQueryable? -
i have database i'm trying query via entity framework , select return data collection output object - while using iqueryable
improve performance - , apply couple functions resultant data comes db query. one, can't use .tolocaltime()
on datetime
object it's not supported. error:
linq entities not recognize method 'system.datetime tolocaltime()' method, , method cannot translated store expression.
if try call other custom functions on returned data similar exception.
here code below:
iqueryable<databaseentitytype> query = context.myentities.where(c=> c.finished == true); db.myentities.orderbydescending(c => c.datecreated).select(c => new outputobject() { guid = c.guid, notes = c.notes, datecreated = c.datecreated.tolocaltime(), related = string.join("<br/>", c.relatedentities.select(c => c.tractnumber)), others = string.join("<br/>", c.otherrelatedentities.select(c => c.ownername)), documenttype = enumutility.getdocumenttypestring(c.documenttype), uploader = c.account.firstname + " " + c.account.lastname, });
is there way while still using iqueryable
? have large data set needs filtered on server without using .tolist()
.
Comments
Post a Comment