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.

Using BindingSourceControls with the DataBridge 666<br />

Instantiating the DataBridge Class in the Form 666<br />

Populating the Form with an <strong>Entity</strong> and Its Related Data 667<br />

Consuming the Pick Lists in the Form 669<br />

Deleting from Grids When <strong>Entity</strong>Collections and Referential Constraints<br />

Are Involved 670<br />

Allowing Users to Roll Back Their Edits 675<br />

Helping the User Who Forgets to Save Changes 676<br />

Summary 677<br />

21. Using the <strong>Entity</strong> <strong>Framework</strong> in n-Tier ASP.NET Applications . . . . . . . . . . . . . . . . . . 679<br />

Understanding How an ObjectContext Fits into the Web Page Life Cycle 680<br />

Using <strong>Entity</strong>Objects in Read-Only Web Pages 681<br />

Exploring Options for Updating Entities in an ASP.NET Application 684<br />

Evaluating ASP.NET’s State Solutions Against the <strong>Entity</strong> <strong>Framework</strong> 685<br />

Introducing ASP.NET’s ObjectDataSource Control 689<br />

Why ObjectDataSource? 689<br />

ObjectDataSource Enforces Its Rules on Your Objects 689<br />

How the ObjectDataSource Gets Data into and out of the Data-Binding<br />

Controls 690<br />

Designing Object Provider Classes to Be Used with an ObjectDataSource 691<br />

Creating the CustomerProvider Class 692<br />

Creating the AddressProvider Class 697<br />

Creating the ReservationsProvider Class 701<br />

Providing Reusable, Cached Reference Lists 702<br />

Wiring Up the Provider Classes to ObjectDataSource Controls 704<br />

Using the ObjectDataSource Wizard to Perform the Initial Wiring to<br />

the Provider Classes 705<br />

Tweaking ObjectDataSource Properties to Work with Entities 705<br />

Using ObjectDataSource Events to Solve Problems That Are Particular<br />

to Entities 706<br />

Understanding Why We Didn’t Use Object Graphs in This Business Layer 713<br />

Database Hits Versus Very Busy Memory 713<br />

Summary 714<br />

22. Implementing a Smarter WCF Service for Working with Entities . . . . . . . . . . . . . . 717<br />

Will Your Client Agree to Your Data Contract? 718<br />

Shipping DTOs, Not <strong>Entity</strong>Objects 719<br />

Building a Data Transfer Object to Take the Place of an <strong>Entity</strong> Object 719<br />

Creating <strong>Entity</strong>State Properties That Do Not Rely on ObjectContext 722<br />

The <strong>Entity</strong>StateLocal Enums and Interface 723<br />

Implementing the I<strong>Entity</strong>StateLocal Interface in the DTO Classes 724<br />

Implementing the I<strong>Entity</strong>StateLocal Interface in the <strong>Entity</strong> Classes 724<br />

Table of Contents | xix

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

Saved successfully!

Ooh no, something went wrong!