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.

Determining Which Navigation Property Is Mapped to Which Foreign<br />

Key Field 158<br />

Mapping a Few Stored Procedures 159<br />

Mapping the Insert Function 159<br />

Mapping the Update Function 160<br />

Working with Many-to-Many Relationships 163<br />

Building the BreakAwayModel Project 165<br />

Don’t Overlook the Assembly and Model Names 165<br />

The Impact of Compiling a Project on an EDMX File 166<br />

Summary 168<br />

8. Data Binding with Windows Forms and WPF Applications . . . . . . . . . . . . . . . . . . . 169<br />

Data Binding with Windows Forms Applications 169<br />

Creating a Windows Forms Application 170<br />

Using Windows Forms Data Sources to Help with Data Binding 171<br />

Creating an Object Data Source for a Customer <strong>Entity</strong> 172<br />

Getting the <strong>Entity</strong>’s Details onto the Form 175<br />

Adding Code to Perform the EDM Query 175<br />

Testing the Sample 178<br />

Entities, BindingSources, and a Very Important Rule 178<br />

Adding the Related <strong>Entity</strong>Collection to the Form 179<br />

Allowing the User to Edit the Data 183<br />

Editing the Navigation Properties (and Trimming Down the Query) 184<br />

Adding New Customers 188<br />

Data Binding with WPF Applications 193<br />

Creating the WPF Form 194<br />

Creating the New Project 194<br />

Adding Code to Query the Entities That Drive the Form 195<br />

XAML’s Role in Data Binding 197<br />

Binding with the ListBox 197<br />

Testing the Example 199<br />

Selecting an <strong>Entity</strong> and Seeing Its Details 199<br />

Adding Another <strong>Entity</strong>Collection to the Mix: Activities 201<br />

Editing Trip Entities and Their Related Data 204<br />

Adding Items to the Child <strong>Entity</strong>Collection 207<br />

The Last Task: Adding New Trips to the Catalog 209<br />

Summary 213<br />

9. Working with Object Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215<br />

Where Does Object Services Fit into the <strong>Framework</strong>? 215<br />

Query Processing 216<br />

From Query to Command Tree to SQL 217<br />

A Better Understanding of Query Builder Methods 218<br />

Table of Contents | ix

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

Saved successfully!

Ooh no, something went wrong!