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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -