How call functions from data base in EF

痴心易碎 提交于 2019-12-25 08:27:16

问题


I generate a model from my database.

In the .edmx file I have a row string

<Function Name="GetUniqueInt" ReturnType="int" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" />

as its cause?


回答1:


You need to create stub method for your function somewhere. It should look like:

[EdmFunction("YourModelNamespace", "GetUniqueInt")]
public static int GetUniqueInt()
{
    throw new NotSupportedException("Direct calls are not supported.");
}

Place this method for example to your context class and use it in LINQ queries.



来源:https://stackoverflow.com/questions/8383747/how-call-functions-from-data-base-in-ef

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!