问题
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