Part 8 Using stored procedures with entity framework code first approach HD

15.05.2014
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/05/part-8-using-stored-procedures-with.html In this video we will discuss using stored procedures to perform Insert, Update and Delete operations using entity framework code first approach. public class EmployeeDBContext : DbContext { public DbSet[Employee] Employees { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { // This line will tell entity framework to use stored procedures // when inserting, updating and deleting Employees modelBuilder.Entity[Employee]().MapToStoredProcedures(); base.OnModelCreating(modelBuilder); } } Entity Framework will create the following stored procedures automatically Employee_Delete Employee_Insert Employee_Update The default, naming convention for the stored procedures INSERT stored procedure - EntityName_Insert UPDATE stored procedure - EntityName_Update DELETE stored procedure - EntityName_DeleteNote: Insert Stored procedure should return the auto-generated identity column value

Похожие видео

Показать еще