EdmFunction must be qualified with model name?
Book "Johnson Glenn - Accessing Data with Microsoft .NET Framework 4 - 2011" contains example of custom function, and call of function:
gv.DataSource = (... select new { ... , ModelDefinedFunctions.Detail(..)});
But on CD in practice tests with that book:
var instructors = from p in context.People
wh开发者_JS百科ere YearsSince((DateTime)p.HireDate) > 10
select p;
and explanation: You must refer to the custom function using the method name. The method name must not be qualified with the model name. The method requires a DateTime parameter and this must be included.
Don't have VS now, what is the right way?
ModelDefinedFunctions
is the name of the class where the method Detail
is defined. The two approaches are identical. There is no qualifier for the model name.
精彩评论