kamal
kamal

Reputation: 21

Stored Procedure in Entity Framework

I had added the Stored procedure in my Entity framework and i also imported the functions in the edmx. Is it must to add all the three functions insert, update, and delete functions to a table. I had tried with insert alone and also with all, but why can't i get the name of the stored procedure in the connection string.

Let me know what i done clearly.

  1. I had added the sp
  2. i had imported the functions in the model browser.
  3. i had also mapped the insert, update and delete function to the table with return type only for insert and update. Still i can't get the name of SP in the connection string.

    Please let me know how could i resolve this issue. Thanks in Advance, Kamal.

Upvotes: 0

Views: 2014

Answers (2)

n535
n535

Reputation: 5123

It is not clear what issue you are trying to resolve.

Connection strings have nothing to do with stored procedure's names. They are used to store information about connection, which is sent to an sql server instance, when you are about to establish a connection.

Why do you care about getting a stored procedure's name at runtime in the first place? If you are just mapping procedures to insert/update/delete operations, they will be called automatically, when the appropriate operations are triggered.

As to the required mappings, as far as i remember, you can map insert operation alone (at least in EF 4.0+), but insert and delete operations should always be mapped together.

Upvotes: 0

Helio
Helio

Reputation: 613

Here is a detailed step-by-step explanation of how to import a stored procedure into an entity. http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/17/ado-net-entity-framework-tools-stored-procedures.aspx

Upvotes: 1

Related Questions