04.07.2013 Views

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

Programming Entity Framework - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating a Common Wrapper to Handle Query Execution Exceptions 585<br />

SaveChanges Command Execution Exceptions 587<br />

Model and Mapping Constraints Are Broken: UpdateException 587<br />

Exceptions Thrown by Broken Constraints in the Database 588<br />

Automatically Rolling Back SaveChanges When an UpdateException<br />

Occurs 589<br />

ObjectStateEntries Returned by Object Services Exceptions 589<br />

General <strong>Entity</strong> Exceptions That May Occur When Executing Queries<br />

or Commands 590<br />

InvalidOperationExceptions 590<br />

Exceptions When Multiple Parties Edit Data Concurrently 591<br />

Handling Concurrency Conflicts 591<br />

Understanding Optimistic Concurrency Options in the <strong>Entity</strong><br />

<strong>Framework</strong> 592<br />

Ignoring Concurrency Conflicts 592<br />

Forcing the User’s Data to the Server (ClientWins) 593<br />

Refreshing the User’s Data with Server Data (StoreWins) 593<br />

Determining the Scope of Changes 593<br />

Using rowversion for Concurrency Checks 594<br />

Implementing Optimistic Concurrency with the <strong>Entity</strong> <strong>Framework</strong> 595<br />

Flagging a Property for Concurrency Checking 595<br />

How the <strong>Entity</strong> <strong>Framework</strong> Uses the ConcurrencyMode Property 595<br />

Concurrency Checking Without a rowversion Field 597<br />

Concurrency Checking on a Checksum in the Data Store 597<br />

Concurrency Checks for <strong>Entity</strong>Reference Navigation Properties 598<br />

Concurrency Checks and Inherited Types 598<br />

Concurrency Checks and Stored Procedures 600<br />

Handling OptimisticConcurrencyExceptions 602<br />

Using ObjectContext.Refresh 602<br />

Using ClientWins Refresh 603<br />

Using StoreWins Refresh 605<br />

Refreshing Collections of Entities 606<br />

Refreshing Related Entities in a Graph 608<br />

Rewinding and Starting Again, and Maybe Again After That 609<br />

What If a Relationship, But No Scalar Properties, Changes? 611<br />

Reporting an Exception 612<br />

Handling Concurrency Exceptions at a Lower Level 613<br />

Handling Granular Exceptions Without User Intervention 613<br />

Handling Multiple Conflicts 616<br />

Handling Exceptions When Transactions Are Your Own 617<br />

Summary 619<br />

Table of Contents | xvii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!