In the entity framework, I'm attempting to utilize a stored procedure. I first generated the model without the stored procedure. Then I proceeded to Update Model from Database, made my selection of the desired stored procedure, and inserted it using the function import. Now that the function is shown under Function Imports in the model browser, I can see it, but when I attempt to use it on the object context, I get an error stating that the "xxModel" does not include a definition for the "xxfunction". Anyone know what I may be doing incorrectly?
In the file pertaining to the proc, I don't find any issues.
The tags for the saved procs in the edmx file are listed below.
<Function Name="p_DeleteDealFacts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> <Parameter Name="DealID" Type="int" Mode="In" /> <FunctionImportMapping FunctionImportName="DeleteDealFacts" FunctionName="InterceptModel.Store.p_DeleteDealFacts" /> </EntityContainerMapping>
If and only if you indicate that the return type should be an entity type, Visual Studio will construct the function code in the model's code-behind. Null and scalar return types are incompatible. I think it looks like a bug. Here is the whole narrative: Function Imports with a Non-Entity Return Type in an Entity Model