Part 8 Using stored procedures with entity framework code first approach



16
126176

Text version of the video http://csharp-video-tutorials.blogspot.com/2014/05/part-8-using-stored-procedures-with.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 Slides http://csharp-video-tutorials.blogspot.com/2014/05/part-8-using-stored-procedures-with_14.html Entity Framework - All Text Articles http://csharp-video-tutorials.blogspot.com/2014/05/entity-framework-tutorial.html Entity Framework - All Slides http://csharp-video-tutorials.blogspot.com/2014/05/entity-framework-tutorial-slides.html Entity Framework Playlist https://www.youtube.com/playlist?list=PL6n9fhu94yhUPBSX-E2aJCnCR3-_6zBZx Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd 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

Published by: kudvenkat Published at: 10 years ago Category: آموزشی