Stored Procedure in Entity Framework:

Entity Framework has ability to automatically build native commands for database based on your LINQ to Entities or Entity SQL queries, as well as build the commands for inserting, updating, or deleting data, you may want to override these steps and use your own predefined stored procedures. You can use stored procedures mainly for either to get the data or add/update/delete the records to one or multiple database tables.


Stored procedures and user-defined functions (UDFs) in the database are represented as functions in entity framework. So you won’t have any entity or other stuff for stored procedures in the EDM designer. But you have to perform some extra steps to make stored procedures work in the entity framework which we will see soon.


One important point to remember is that the EDM designer doesn’t allow you to write stored procedures and bring them into the database. That means it doesn’t matter whether you opt for the code-first, model-first or database-first approach. You always have to create your stored procedures in the database and later import them into the EDM


In the next chapter, we will see how to work with Stored Procedures for CRUD operation using Entity Framework 4.3.



Entity Framework