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)
Namoskar!!!
Comments
Anonymous
September 01, 2011
if I have some object to return, How I can do?Anonymous
February 16, 2012
its not clear to me. how can we use blog or add comments. actually i m using it for the very 1st time.Anonymous
October 28, 2012
Thanks, this is great. But please, next time don't post an image, post code that can be copied!Anonymous
October 29, 2012
it should be the same as you do in TSQL