Contents


foreword
preface
acknowledgments
about this book
about the cover illustration

Part 1 Redefining your data-access strategy

Chapter 1 Data access reloaded: Entity Framework
Getting started with data access
Developing applications using database-like structures
Using classes to organize data
Delving deep into object/relational differences
Letting Entity Framework ease your life
How Entity Framework performs data access
Summary
Chapter 2 Getting started with Entity Framework
Introducing the OrderIT example
Designing the OrderIT model and database
Structuring the application
A sneak peek at the code
Summary

Part 2 Getting started with Entity Framework

Chapter 3 Querying the object model: the basics
One engine, many querying methods
The query engine entry point: Object Services
Summary
Chapter 4 Querying with LINQ to Entities
Filtering data
Projecting results
Grouping data
Sorting
Joining data
Querying with inheritance
Using functions
Executing handmade queries
Fetching
Summary
Chapter 5 Domain model mapping
The Entity Data Model
Creating consumable entities
Defining relationships in the model
Mapping inheritance
Extending the EDM with custom annotations
Summary
Chapter 6 Understanding the entity lifecycle
The entity lifecycle
Managing entity state
Managing change tracking with ObjectStateManager
Summary
Chapter 7 Persisting objects into the database
Persisting entities with SaveChanges
Persisting changed entities into the database
Persisting entities graphs
A few tricks about persistence
Summary
Chapter 8 Handling concurrency and transactions
Understanding the concurrency problem
Handling concurrency in Entity Framework
Managing transactions
Summary

Part 3 Mastering Entity Framework

Chapter 9 An alternative way of querying: Entity SQL
Query basics
Filtering data
Projecting results
Grouping data
Sorting data
Joining data
Querying for inheritance
Using query-builder methods
Working with the Entity Client data provider
Summary
Chapter 10 Working with stored procedures
Mapping stored procedures
Returning data with stored procedures
Embedding functions in the storage model
Updating data with stored procedures
Summary
Chapter 11 Working with functions and views
Views in the storage model: defining queries
User-defined functions and scalar-valued functions
Summary
Chapter 12 Exploring EDM metadata
Metadata basics
Retrieving metadata
Building a metadata explorer
Writing generic code with metadata
Summary
Chapter 13 Customizing code and the designer
How Visual Studio generates classes
Customizing class generation
How Visual Studio generates database DDL
Customizing DDL generation
Creating designer extensions
Summary

Part 4 Applied Entity Framework

Chapter 14 Designing the application around Entity Framework
The application design process
A typical three-layer architecture
Principles of domain-driven design
Retrieving references to a domain’s entities
Summary
Chapter 15 Entity Framework and ASP.NET
EntityDataSource, a new approach to data binding
Using Dynamic Data controls with Entity Framework
The ObjectContext lifecycle in ASP.NET
Common scenarios involving ASP.NET and Entity Framework
Summary
Chapter 16 Entity Framework and n-tier development
n-Tier problems and solutions
Developing a service using entities as contracts
Developing a service using DTOs
Developing a service using STEs
Summary
Chapter 17 Entity Framework and Windows applications
An example application
Designing model classes for binding
Binding in Windows Forms applications
Binding in WPF applications
Summary
Chapter 18 Testing Entity Framework
Unit tests at a glance
Writing a test suite in Visual Studio 2010
Isolating dependencies
Unit-testing the data access layer
Testing the persistence and retrieval of an entity
Summary
Chapter 19 Keeping an eye on performance
Testing configuration and environment
Database-writing comparison
Query comparisons in the default environment
Optimizing performance
Summary


appendix A : Understanding LINQ
appendix B : Entity Framework tips and tricks
index