Exit 70-516 TS: Accessing Data with Microsoft .NET Framework 4
Question 1 of 5
0% complete
Q1 Single choice

You use Microsoft .NET Framework 4.0 and the Entity Framework to develop an application. You create an Entity Data Model that has an entity named Customer.
You set the optimistic concurrency option for Customer.

You load and modify an instance of Customer named loadedCustomer, which is attached to an ObjectContext named context.

You need to ensure that if a concurrency conflict occurs during a save, the application will load up-to-date values fromthe database while preserving local changes.

Which code segment should you use?

  • A

    try{context.SaveChanges();}catch(EntitySqlException ex) {context.Refresh(RefreshMode.StoreWins, loadedCustomer);}

  • B

    try{context.SaveChanges();}catch(OptimisticConcurrencyException ex) {context.Refresh(RefreshMode.ClientWins, loadedCustomer);}

  • C

    try{context.SaveChanges();}catch(EntitySqlException ex) {context.Refresh(RefreshMode.ClientWins, loadedCustomer);}

  • D

    try{context.SaveChanges();}catch(OptimisticConcurrencyException ex) {context.Refresh(RefreshMode.StoreWins, loadedCustomer);}

Previous Next