c# - How to use custom functions in ADO.NET Entity queries -


does know how use custom functions in ado.net entity queries?

var data = w in _context.workers select new workerdata() { worktime = hoursminssecs(w.starttime, w.stoptime); };  public string hoursminssecs(datetime starttime, datetime endtime) { timespan span = (endtime - starttime);  return string.format("{0} hours, {1} minutes, {2} seconds",                                  span.hours, span.minutes, span.seconds); } 

i'm getting error:

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

it'is impossible, have write own linq provider make them work. can use ef canonical functions out of box.


Comments

Popular posts from this blog

python 3.x - Mapping specific letters onto a list of words -

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -