Why won't EF4 generate a method to support my Function Import?
- by Deane
I have a stored proc in my database which returns an integer. I added a Function Import to my model. This appears in the EDMX file:
<Function Name="GetTotalEntityCount" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" />
However, no method actually gets generated for this. It should be top level, right?
using (MyContext context = new MyContext())
{
context.MyMethodShouldBeRightHere();
}
Nothing appears in Intellisense, I've gone through the designer.cs file and there's nothing in there, and reflected the DLL...nothing. The code generator is just not generating any code to support this stored proc.
I added another table to my database and updated the model, and that came in, so the model will update, it's just specifically ignoring this stored proc.
I've tried everything I can think of, and consulted every resource I can find, and as near as I can tell, I'm doing everything right.
I'm using EF4, database-first. (I'm pretty sure on the version, anyway. This shows up in the generated file:
Runtime Version:4.0.30319.1
)