开发者

EdmFunction must be qualified with model name?

开发者 https://www.devze.com 2023-04-01 20:59 出处:网络
Book \"Johnson Glenn -Accessing Data with Microsoft .NET Framework 4 - 2011\" contains example of custom function, and call of function:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消