How to call functions from a database in EF

I am creating a model from my database.

In the .edmx file I have a string of lines

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

as a reason?

0
source share
1 answer

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

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

Put this method, for example, in your context class and use it in LINQ queries.

+2
source

All Articles