0

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?

Crab Bucket
  • 6,219
  • 8
  • 38
  • 73
Deniska d
  • 59
  • 11

1 Answers1

2

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.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • I not understand "throw new NotSupportedException("Direct calls are not supported.");" not have to change? – Deniska d Dec 05 '11 at 11:27
  • It is stub method. It is supposed to be called only in Linq-to-entities query where its content is never called because it is translated to your SQL function call. – Ladislav Mrnka Dec 05 '11 at 11:48