Database Reference
In-Depth Information
Figure 14-7. When mapping the stored procedures to the insert, update, and delete actions, make sure that you check
the Rows Affected Parameter check boxes and Use Original Value check box as shown
When we call the SaveChanges() method in Listing 14-10 to update, insert, or delete, these actions are performed
by the stored procedures in Listing 14-9 because of the mappings shown in Figure 14-7 . Both the insert and update
procedures return the updated TimeStamp value. This value is used by Entity Framework to enforce optimistic
concurrency.
Listing 14-10. Demonstrating the stored procedures mapped to the insert, update, and delete actions
using (var context = new EF6RecipesContext())
{
context.Accounts.Add(new Account { AccountNumber = "8675309",
Balance = 100M, Name = "Robin Rosen"});
context.Accounts.Add(new Account { AccountNumber = "8535937",
Balance = 25M, Name = "Steven Bishop"});
context.SaveChanges();
}
 
Search WWH ::




Custom Search