I recently received a copy of Julie Lerman's "Programming Entity Framework" 2nd Edition. As you may/may not know, I've been rather disappointed by any set of objects that get between me and my database. I like to be fast and highly optimized for my database connections, commands, and transactions. I've been rather disappointed with NHibernate's lack of support outside of Sql Server, the fact that there are is a lot of hand editing of the support files, and honestly Entity Framework 1 had enough problems that I decided to stay away. As I got into Azure, I was doing a lot of LINQ and Entity Framework 1 stuff and starting to be more interested in these technologies. When .NET 4 shipped, I made the decision to start using EF with new projects. The only way to effectively learn a new product is to immerse yourself in it completely. Most of my work to this point has been with simple EF and Linq. As I have gotten deeper into it, I've been turning to Julie over email and IM to resolve issues that I have had.
Now that I have my own copy of Julie (by way of Julie's book), I won't need to bother her quite so much. I've been reading through the book and am amazed at the content that she covers. It discusses all of the features that I need to cover plus more. She starts you off with the basics of Entities and Entity Framework and how its different from the typical thinking we have of databases, goes through simple CRUD, gets into integrating with stored procedures, and then gets into the good stuff. Wow, who would have thought that there is support for multi-threading, testing, and the complexities of transactions! If you are getting into Entity Framework, this is the book for you! Run out and get it now. Its the next best thing to having Julie Lerman sitting right next to you helping you with your code. Its available on Amazon and at O'Reilly's site.
Book Description: Get a thorough introduction to ADO.NET Entity Framework 4 -- Microsoft's
core framework for modeling and interacting with data in .NET
applications. The second edition of this acclaimed guide provides a
hands-on tour of the framework latest version in Visual Studio 2010 and
.NET Framework 4. Not only will you learn how to use EF4 in a variety of
applications, you'll also gain a deep understanding of its architecture
and APIs. From the Entity Data Model and Object Services to WCF
Services, MVC Apps, and unit testing, this book covers everything.
Table of Contents
Chapter 1 Introducing the ADO.NET Entity Framework
The Entity Relationship Model: Programming Against a Model, Not the Database
The Entity Data Model: A Client-Side Data Model
Entities: Blueprints for Business Classes
The Backend Database: Your Choice
Entity Framework Features: APIs and Tools
The Entity Framework and WCF Services
What About ADO.NET DataSets and LINQ to SQL?
Entity Framework Pain Points Are Fading Away
Programming the Entity Framework
Chapter 2 Exploring the Entity Data Model
Why Use an Entity Data Model?
The EDM Within the Entity Framework
Walkthrough: Building Your First EDM
Inspecting the EDM in the Designer Window
The Model’s Supporting Metadata
Viewing the Model in the Model Browser
Viewing the Model’s Raw XML
CSDL: The Conceptual Schema
SSDL: The Store Schema
MSL: The Mappings
Database Views in the EDM
Summary
Chapter 3 Querying Entity Data Models
Query the Model, Not the Database
Your First EDM Query
Querying with LINQ to Entities
Querying with Object Services and Entity SQL
Querying with Methods
The Shortest Query
ObjectQuery, ObjectSet, and LINQ to Entities
Querying with EntityClient to Return Streamed Data
Translating Entity Queries to Database Queries
Avoiding Inadvertent Query Execution
Summary
Chapter 4 Exploring LINQ to Entities in Greater Depth
Getting Ready with Some New Lingo
Projections in Queries
Projections in LINQ to Entities
Using Navigations in Queries
Joins and Nested Queries
Grouping
Shaping Data Returned by Queries
Loading Related Data
Retrieving a Single Entity
Finding More Query Samples
Summary
Chapter 5 Exploring Entity SQL in Greater Depth
Literals in Entity SQL
Projecting in Entity SQL
Using Navigation in Entity SQL Queries
Using Joins
Nesting Queries
Grouping in Entity SQL
Shaping Data with Entity SQL
Understanding Entity SQL’s Wrapped and Unwrapped Results
Summary
Chapter 6 Modifying Entities and Saving Changes
Keeping Track of Entities
Saving Changes Back to the Database
Inserting New Objects
Inserting New Parents and Children
Deleting Entities
Summary
Chapter 7 Using Stored Procedures with the EDM
Updating the Model from a Database
Working with Functions
Mapping Functions to Entities
Using the EDM Designer Model Browser to Import Additional Functions into Your Model
Mapping the First of the Read Stored Procedures: ContactsbyState
Mapping a Function to a Scalar Type
Mapping a Function to a Complex Type
Summary
Chapter 8 Implementing a More Real-World Model
Introducing the BreakAway Geek Adventures Business Model and Legacy Database
Creating a Separate Project for an EDM
Inspecting and Cleaning Up a New EDM
Setting Default Values
Mapping Stored Procedures
Working with Many-to-Many Relationships
Inspecting the Completed BreakAway Model
Building the BreakAway Model Assembly
Summary
Chapter 9 Data Binding with Windows Forms and WPF Applications
Data Binding with Windows Forms Applications
Data Binding with WPF Applications
Summary
Chapter 10 Working with Object Services
Where Does Object Services Fit into the Framework?
Processing Queries
Materializing Objects
Managing Object State
Managing Relationships
Taking Control of ObjectState
Sending Changes Back to the Database
Implementing Serialization, Data Binding, and More
Summary
Chapter 11 Customizing Entities
Partial Classes
Using Partial Methods
Subscribing to Event Handlers
Creating Your Own Partial Methods and Properties
Overriding Default Code Generation
Summary
Chapter 12 Data Binding with RAD ASP.NET Applications
Using the EntityDataSource Control to Access Flat Data
Understanding How the EntityDataSource Retrieves and Updates Your Data
Working with Related EntityReference Data
Working with Hierarchical Data in a Master/Detail Form
Exploring EntityDataSource Events
Building Dynamic Data Websites
Summary
Chapter 13 Creating and Using POCO Entities
Creating POCO Classes
Change Tracking with POCOs
Loading Related Data with POCOs
Exploring and Correcting POCOs’ Impact on Two-Way Relationships
Using Proxies to Enable Change Notification, Lazy Loading, and Relationship Fix-Up
Using T4 to Generate POCO Classes
Creating a Model That Works with Preexisting Classes
Code First: Using Entity Framework with No Model at All
Summary
Chapter 14 Customizing Entity Data Models Using the EDM Designer
Mapping Table per Type Inheritance for Tables That Describe Derived Types
Mapping Unique Foreign Keys
Mapping an Entity to More Than One Table
Splitting a Single Table into Multiple Entities
Filtering Entities with Conditional Mapping
Implementing Table per Hierarchy Inheritance for Tables That Contain Multiple Types
Creating Complex Types to Encapsulate Sets of Properties
Using Additional Customization Options
Summary
Chapter 15 Defining EDM Mappings That Are Not Supported by the Designer
Using Model-Defined Functions
Mapping Table per Concrete (TPC) Type Inheritance for Tables with Overlapping Fields
Using QueryView to Create Read-Only Entities and Other Specialized Mappings
Summary
Chapter 16 Gaining Additional Stored Procedure and View Support in the Raw XML
Reviewing Procedures, Views, and UDFs in the EDM
Working with Stored Procedures That Return Data
Executing Queries on Demand with ExecuteStoreQuery
Adding Native Queries to the Model
Adding Native Views to the Model
Using Commands That Affect the Database
Mapping Insert/Update/Delete to Types Within an Inheritance Structure
Implementing and Querying with User-Defined Functions (UDFs)
Summary
Chapter 17 Using EntityObjects in WCF Services
Planning for an Entity Framework–Agnostic Client
Building a Simple WCF Service with EntityObjects
Implementing the Service Interface
Building a Simple Console App to Consume an EntityObject Service
Creating WCF Data Services with Entities
Understanding How WCF RIA Services Relates to the Entity Framework
Summary
Chapter 18 Using POCOs and Self-Tracking Entities in WCF Services
Creating WCF-Friendly POCO Classes
Building a WCF Service That Uses POCO Classes
Using the Self-Tracking Entities Template for WCF Services
Using POCO Entities with WCF Data and RIA Services
Sorting Out the Many Options for Creating Services
Summary
Chapter 19 Working with Relationships and Associations
Deconstructing Relationships in the Entity Data Model
Understanding the Major Differences Between Foreign Key Associations and Independent Associations
Deconstructing Relationships Between Instantiated Entities
Defining Relationships Between Entities
Learning a Few Last Tricks to Make You a Relationship Pro
Summary
Chapter 20 Real World Apps: Connections, Transactions, Performance, and More
Entity Framework and Connections
Fine-Tuning Transactions
Understanding Security
Fine-Tuning Performance
Exploiting Multithreaded Applications
Exploiting .NET 4 Parallel Computing
Summary
Chapter 21 Manipulating Entities with ObjectStateManager and MetadataWorkspace
Manipulating Entities and Their State with ObjectStateManager
Using ObjectStateManager to Build an EntityState Visualizer
Using the MetadataWorkspace
Building Dynamic Queries and Reading Results
Creating and Manipulating Entities Dynamically
Summary
Chapter 22 Handling Exceptions
Preparing for Exceptions
Handling EntityConnectionString Exceptions
Handling Query Compilation Exceptions
Creating a Common Wrapper to Handle Query Execution Exceptions
Handling Exceptions Thrown During SaveChanges Command Execution
Handling Concurrency Exceptions
Summary
Chapter 23 Planning for Concurrency Problems
Understanding Database Concurrency Conflicts
Understanding Optimistic Concurrency Options in the Entity Framework
Implementing Optimistic Concurrency with the Entity Framework
Handling OptimisticConcurrencyExceptions
Handling Concurrency Exceptions at a Lower Level
Handling Exceptions When Transactions Are Your Own
Summary
Chapter 24 Building Persistent Ignorant, Testable Applications
Testing the BreakAway Application Components
Getting Started with Testing
Creating Persistent Ignorant Entities
Building Tests That Do Not Hit the Database
Using the New Infrastructure in Your Application
Application Architecture Benefits from Designing Testable Code
Considering Mocking Frameworks?
Summary
Chapter 25 Domain-Centric Modeling
Creating a Model and Database Using Model First
Using the Feature CTP Code-First Add-On
Using SQL Server Modeling’s “M” Language
Summary
Chapter 26 Using Entities in Layered Client-Side Applications
Isolating the ObjectContext
Separating Entity-Specific Logic from ObjectContext Logic
Working with POCO Entities
Summary
Chapter 27 Building Layered Web Applications
Understanding How ObjectContext Fits into the Web Page Life Cycle
Building an N-Tier Web Forms Application
Building an ASP.NET MVC Application
Editing Entities and Graphs on an MVC Application
Summary
Appendix Entity Framework Assemblies and Namespaces
Unpacking the Entity Framework Files
Exploring the Namespaces
Appendix Data-Binding with Complex Types
Using Complex Types with ASP.NET EntityDataSource
Identifying Unexpected Behavior When Binding Complex Types
Appendix Additional Details About Entity Data Model Metadata
Seeing EDMX Schema Validation in Action
Additional Conceptual Model Details
Additional SSDL Metadata Details
Additional MSL Metadata Details