Table of Contents (First Edition)
Preface
Ch 1: Introducing the ADO.NET Entity Framework |
||
Programming Against a Model, Not Against the Database | ||
The Entity Data Model: A Client-Side Data Model | ||
The Entity in “Entity Framework” | ||
Choosing Your Backend | ||
Entity Framework Features | ||
The Entity Framework in Web Services | ||
What About ADO.NET DataSets and LINQ to SQL? | ||
Entity Framework Pain Points | ||
Programming the Entity Framework | ||
Ch 2: Exploring the Entity Data Model | ||
Why Use an Entity Data Model? | ||
The EDM Within the Entity Framework | ||
Your First EDM | ||
The EDM in the Designer Window | ||
Entity Properties | ||
The Naked Model: Inspecting the Model’s XML | ||
A Less Daunting Model View | ||
The Three Parts of the Model | ||
CSDL: The Conceptual Schema | ||
SSDL: The Store Schema | ||
MSL: The Mappings | ||
Database Views in the EDM | ||
Code Generation from EDM to Classes | ||
Ch 3: Querying Entity Data Models | ||
Query the Model, Not the Database | ||
Your First EDM Query | ||
LINQ to Entities Queries | ||
Entity SQL Queries That Return Objects | ||
Method-Based Syntax Queries for LINQ and Entity SQL | ||
LINQ Method-Based Queries | ||
EntityClient: The Lowest-Level Method for Returning Streamed Data | ||
Translation to Database Queries | ||
Avoid Inadvertent Query Execution | ||
Ch 4: Exploring EDM Queries in Greater Depth | ||
Same Model, Friendlier Name | ||
Projections in Queries | ||
Querying Across Associations | ||
Joins and Nested Queries | ||
Grouping | ||
Shaped Data Returned by Queries | ||
Deferred Loading and Eager Loading Queries | ||
Retrieving a Single Entity | ||
Entity SQL’s Wrapped and Unwrapped Results | ||
Modifying Entities and Saving Changes | ||
How ObjectContext Manages Entities | ||
The SaveChanges Method | ||
Adding New Entities | ||
Inserting New Parents and Children | ||
Deleting Entities | ||
Using Stored Procedures with the EDM | ||
Adding the Stored Procedures into the Model | ||
Working with Functions | ||
Implementing Functions | ||
The EDM Designer’s Model Browser | ||
Mapping the Last of the Four Functions: CustomersbyState | ||
More About the Update Model Wizard | ||
Tuning Up a Model | ||
The BreakAway Geek Adventures Business Model | ||
Creating a Class Library Project to Host an EDM | ||
Inspecting and Cleaning Up a New Model | ||
Cleaning Up Navigation Property Names | ||
Mapping a Few Stored Procedures | ||
Working with Many-to-Many Relationships | ||
Building the BreakAwayModel Project | ||
Data Binding with Windows Forms and WPF Applications | ||
Data Binding with Windows Forms Applications | ||
Using Windows Forms Data Sources to Help with Data Binding | ||
Adding the Related EntityCollection to the Form | ||
Allowing the User to Edit the Data | ||
Editing the Navigation Properties (and Trimming Down the Query) | ||
Data Binding with WPF Applications | ||
XAML’s Role in Data Binding | ||
Binding with the ListBox | ||
Selecting an Entity and Seeing Its Details | ||
Adding Another EntityCollection to the Mix: Activities | ||
Editing Trip Entities and Their Related Data | ||
Adding Items to the Child EntityCollection | ||
The Last Task: Adding New Trips to the Catalog | ||
Working with Object Services | ||
Where Do Object Services Fit into the Framework? | ||
Query Processing | ||
Object Materialization | ||
The ObjectContext | ||
State Management and ObjectStateEntry | ||
Additional Features | ||
Customizing Entities | ||
Partial Classes | ||
Customizable Methods | ||
Customizable Event Handlers | ||
Other Opportunities for Customization | ||
Custom Properties | ||
Custom Code Generation | ||
Creating Common Methods or Properties for All Entities | ||
Using the ASP.NET EntityDataSource Control | ||
Getting to First Base with the EntityDataSource Control and Flat Data | ||
Understanding How the EntityDataSource Is Able to Retrieve and Update Your Data | ||
Working with Related EntityReference Data | ||
Working with Hierarchical Data in a Master/Detail Form | ||
Browsing Through the EntityDataSource Events | ||
Customizing Entity Data Models | ||
Designer Support for Mappings | ||
Mapping Table per Type Inheritance for Tables That Describe Derived | ||
Using Entity Splitting to Map a Single Entity to More Than One Table | ||
Using Conditional Mapping to Filter Entity Mappings | ||
Implementing Table per Hierarchy Inheritance for Tables That Contain | ||
Implementing Customizations That Are Not Supported by the EDM Designer | ||
Mapping Table per Concrete (TPC) Type Inheritance for Tables with Overlapping Fields | ||
Creating Complex Types to Encapsulate Sets of Properties | ||
Using QueryView to Create Read-Only Entities and Other Specialized | ||
Additional Customization Options | ||
Mapping Stored Procedures | ||
Multiple Entity Sets per Type | ||
Self-Referencing Associations | ||
Working with Stored Procedures When Function Mapping Won’t Do | ||
Does the Procedure Line Up with an Entity? | ||
Overview of Procedures, UDFs, and TVFs in the EDM | ||
Composing Queries Against Functions | ||
Mapping and Executing Query Stored Procedures | ||
Adding Native Queries to the Model | ||
Adding Native Views to the Model | ||
DefiningQuery Is Already in Your Model | ||
Using Commands That Affect the Persisted Database | ||
Defining Insert, Update, and Delete Stored Procedures Directly in the Model | ||
Mapping Insert/Update/Delete to Types Within an Inheritance Structure | ||
Implementing and Querying with User-Defined Functions (UDFs) | ||
Using Entities with Web and WCF Services | ||
Building a Client That Is Ignorant of the Entity Framework | ||
Pros and Cons of an Entity Framework-Agnostic Consumer | ||
Using the Entity Framework with ASMX Web Services | ||
Building the ASMX Service | ||
Building the Client Application | ||
Using the Entity Framework with WCF Services | ||
Building the WCF Service | ||
Building the Client to Consume the WCF Service | ||
Working with Relationships and Associations | ||
Deconstructing Relationships in the Entity Data Model | ||
Deconstructing Relationships Between Instantiated EntityObjects | ||
Understanding Navigation Properties in Entity Objects | ||
Referential Integrity and Constraints | ||
Deletes and Cascading Deletes | ||
Defining Relationships Between Entities | ||
Learning a Few Last Tricks to Make You a Relationship Pro | ||
Making It Real: Connections, Transactions, Performance, and More | ||
EntityConnection and Database Connections in the Entity Framework | ||
The Entity Framework and Transactions | ||
The Entity Framework and Security | ||
The Entity Framework and Performance | ||
Entities in Multithreaded Applications | ||
Controlling Objects with ObjectStateManager and MetadataWorkspace | ||
Managing ObjectStateEntry Objects with ObjectStateManager | ||
Getting an ObjectStateManager and Its Entries | ||
CurrentValues and OriginalValues | ||
Building an ObjectStateEntry Visualizer | ||
ObjectStateManager and SavingChanges | ||
The MetadataWorkspace API | ||
Creating EntityObjects Without Entity Classes | ||
Creating Entities and Graphs Dynamically | ||
Handling Entity Framework Exceptions | ||
Preparing for Exceptions in Entity Framework Code | ||
EntityConnectionString Exceptions | ||
Query Compilation Exceptions | ||
Creating a Common Wrapper to Handle Query Execution Exceptions | ||
SaveChanges Command Execution Exceptions | ||
ObjectStateEntries Returned by Object Services Exceptions | ||
InvalidOperationExceptions | ||
Exceptions When Multiple Parties Edit Data Concurrently | ||
Understanding Optimistic Concurrency Options in the Entity Framework | ||
Implementing Optimistic Concurrency with the Entity Framework | ||
Handling OptimisticConcurrencyExceptions | ||
Handling Exceptions When Transactions Are Your Own | ||
Using Your Own Custom Classes | ||
Mapping Classes to the Entity Data Model | ||
Inheriting from EntityObject | ||
Implementing the IPOCO Interfaces | ||
Custom Class Assemblies and Entity Data Model Files | ||
Using the Entity Framework in n-Tier Client-Side Applications | ||
Thinking in Layers | ||
Finding Your Motivation: A Master/Detail Data Entry Form That Will Use the DataBridge Class | ||
Preventing Non-UI Logic from Leaking into the UI | ||
Implementing Logic That Fits Best in the Entity Partial Classes | ||
Building the CommandExecutor Class | ||
Building the DataBridge Class | ||
Using the DataBridge Class for Data Binding in a Master/Detail Form | ||
Allowing Users to Roll Back Their Edits | ||
Helping the User Who Forgets to Save Changes | ||
Using the Entity Framework in n-Tier ASP.NET Applications | ||
Understanding How an ObjectContext Fits into the Web Page Life Cycle | ||
Using EntityObjects in Read-Only Web Pages | ||
Exploring Options for Updating Entities in an ASP.NET Application | ||
Introducing ASP.NET’s ObjectDataSource Control | ||
Designing Object Provider Classes to Be Used with an ObjectDataSource | ||
Wiring Up the Provider Classes to ObjectDataSource Controls | ||
Understanding Why We Didn’t Use Object Graphs in This Business Layer | ||
Implementing a Smarter WCF Service for Working with Entities | ||
Will Your Client Agree to Your Data Contract? | ||
Shipping DTOs, Not EntityObjects | ||
Creating EntityState Properties That Do Not Rely on ObjectContext | ||
Designing the Service Interface | ||
Implementing the Service Operations | ||
Implementing the Client That Will Use the WCF Service | ||
Building a Business Layer Between the UI and the Services | ||
Testing It All with a Simple Console Application | ||
The Entity Framework, Today and Tomorrow | ||
What About Building Reports with the Entity Framework? | ||
Major Differences Between the Entity Framework and LINQ to SQL | ||
Extensions, Samples, and Solutions from Microsoft | ||
Extensions and APIs | ||
Samples | ||
Learning Tools | ||
Entity Framework v.Next | ||
The Transparent Design Process for the Next Version | ||
Blogs, Forums, and Other Resources | ||
Appendix: Entity Framework Assemblies and Namespaces | ||
I |