I am trying to access a Store Procedure from EntityFramework.
I have followed these steps:
First of all I have created the Stored Procedure in the Azure Data
You may want to refer to this blog post: FunctionImport is not mapped to a store function Error, that discusses a similar problem. The cause apparently being:
I had to make changes to a stored procedure and it got deleted from the Entity Data Model Xml file (*.edmx)
With the following step-by-step solution:
There is an easy solution to fix that error. First open your edmx file and right click on the model that owns the stored procedure. Click Add then select “Add Function Import”.
Add the same Function Import name that is used in your Context file (if like me, the method was already created but messed up, otherwise is all new and it will be recreared anyways). Select the Stored Procedure Name that you are trying to fix. Choose the Entities and click OK. A new window might pop up “Verify that the FunctionImport name is unique”.
If that is the case, and you get the “Verify that the FunctionImport name is unique” window popup, do the following: Open your *.edmx file and right click over the model you want to update. Select “Show in Model Browser”. Now the Model Browser window opens up. Go to: {myProject}.DataModel > EntityContainer: {somethingEntities} > Function Imports. The function import causing the problem should be there, just delete it and save the *.edmx file.
Try to add the Function Import again. Voila! no issues this time. Save the *.edmx file and recreate the context file (by making a simple non-invasive change like adding a space to the {myProject}.Context.tt file). make sure the new method:
public virtual ObjectResultis present in your Context file._NameoftheSP(parametets)
Another troubleshooting resource with similar step-by-step instructions (and images!) on updating the edmx file: The function import cannot be executed because it is not mapped to a store function.