The ________ method of the DbContext can be used to commit a transaction.
- SaveChanges
- CommitTransaction
- ExecuteTransaction
- CompleteTransaction
The correct option is "SaveChanges". In Entity Framework, the SaveChanges method of the DbContext class is used to commit changes made to the entities within the context to the underlying database. When SaveChanges is called, Entity Framework will attempt to save all the pending changes as a single transaction. If the changes are successfully saved, the transaction is committed; otherwise, it will be rolled back.
Loading...
Related Quiz
- In a scenario where the presentation layer requires data from multiple sources, how does Entity Framework in the data layer facilitate this?
- When using Code-First approach, how do you create an index that spans multiple columns?
- What is a non-entity type in the context of Entity Framework?
- How does LINQ to Entities differ from standard LINQ queries?
- How can you implement explicit loading for a collection property in Entity Framework?