Deniska d
Deniska d

Reputation: 59

How call functions from data base in EF

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?

Upvotes: 0

Views: 1108

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364409

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.

Upvotes: 2

Related Questions