Does the Entity Framework support CRUD operations? Where do we use the SaveChanges method?
Yes, the Entity Framework (EF) supports CRUD (Create, Read, Update, Delete) operations.
The SaveChanges method is used in update operations. In the Entity Framework, the records in the transaction are
not updated immediately. Rather, the save all the statements in the end when all properties are updated.
Check out the example below:
using (var = dbContext = new SomeEntities())
ADO.NET Base Classes
SQL Queries through String Concatenation
Deferred Execution in LINQ
Object LINQ Provider VS. Database LINQ Provider
ADO.NET Entity Framework
Silverlight connections to databases
Multiplicity and Degree in Entity Framework
WCF Data Services
Optimistic Concurrency | OptimisticConcurrencyException
Entity Framework and CRUD
var purchaseQuery = from Employer in dbContext.Employers
where employer.EmployerID == 123
from order in employer.PurchaseOrderHeaders
orderby order.PurchaseOrderDate descending
//Now see above that multiple statements are specified
PurchaseOrderHeader latestOrder = orderQuery();
latestOrder.Comment = "Request employer for payment";
More Interview Questions...