filmov
tv
Part 8 Using stored procedures with entity framework code first approach

Показать описание
Text version of the video
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.
Slides
Entity Framework - All Text Articles
Entity Framework - All Slides
Entity Framework Playlist
Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
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
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.
Slides
Entity Framework - All Text Articles
Entity Framework - All Slides
Entity Framework Playlist
Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
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
Комментарии