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

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -