Error calling Stored Procedures from EntityFramework

azure c# entity-framework stored-procedures


I'm attempting to use EntityFramework to access a Store Procedure.

I took the following actions:

In the Azure Database, I first generated the stored procedure as follows:

enter image description here

Then, after simply choosing the StoredProcedure I wanted, I updated the.edmx model from the database.

enter image description here

Once completed, the StoredProcedure is added to the Function Import but not to the section of StoredProcedures. What can I do to make sure it shows up here?

enter image description here

All of the arguments are indicated as input in the Function Import section, however "MaxReference" should be listed as output. How do I alter it?

enter image description here

Despite these two problems, I ran the code:

enter image description here

and I received the subsequent exception:

An error occurred while preparing command definition. See the inner exception for details.

the InnerException, and

The function import 'DataModelEntities.AssignMaxSalesRef' cannot be executed because it is not assigned to a storage function.

enter image description here

5/13/2015 1:47:52 PM

Accepted Answer

5/13/2015 2:09:58 PM

Popular Answer

Although I should have enough reputation to remark on this post, I don't.

I experienced a similar problem. I could see my stored procedures, but I was still getting the problem. Alex asked me a question, and in response I looked in the Model Browser's Function Imports section, where I saw that I had numerous entries for each of the stored methods. To avoid being real copies, they had sequence numbers. I updated the model from the database, deleted everything under Function Imports and Stored Procedures / Functions, and then added everything back. My problem has been fixed.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow