Code First 4.1 : Using Stored Procedure to Insert Data
Code First in Entity Framework does not support Stored Procedure by default. As there is no designer we cannot even map our stored procs to the entity. There are a many scenario we have seen where we are bound to use stored procedure for any database modifications (insert/update/delete). Here is how we can use stored procedure.
This would finally call the Stored Procedure.
The stored proc used here is very simple
ALTER PROCEDURE [dbo].[stp_InsertEmp] ( @Name as VARCHAR(50) ) AS INSERT INTO Emps(Name) VALUES(@Name)