Book description
Entity Framework 4.0 Recipes provides an exhaustive collection of ready-to-use code solutions for Microsoft's Entity Framework, Microsoft's vision for the future of data access. Entity Framework is a model-centric data access platform with an ocean of new concepts and patterns for developers to learn. With this book, you will learn the core concepts of Entity Framework through a broad range of clear and concise solutions to everyday data access tasks. Armed with this experience, you will be ready to dive deep into Entity Framework, experiment with new approaches, and develop ways to solve even the most difficult data access challenges. If you are a developer who likes to learn by example, then this is the right book for you.
Gives ready-to-use, real-world recipes to help you with everyday tasks
Provides guideposts for learning core concepts
Maps out key landmarks for experimenting with your own solutions
Table of contents
- Copyright
- About the Authors
- About the Technical Reviewers
- Acknowledgments
- Preface
- 1. Getting Started With Entity Framework
-
2. Entity Data Modeling Fundamentals
- 2.1. Creating a Simple Model
- 2.2. Creating a Model from an Existing Database
- 2.3. Modeling a Many-to-Many Relationship with No Payload
- 2.4. Modeling a Many-to-Many Relationship with a Payload
- 2.5. Modeling a Self-Referencing Relationship
- 2.6. Splitting an Entity Across Multiple Tables
- 2.7. Splitting a Table Across Multiple Entities
- 2.8. Modeling Table per Type Inheritance
- 2.9. Using Conditions to Filter an ObjectSet
- 2.10. Modeling Table per Hierarchy Inheritance
- 2.11. Modeling Is-a and Has-a Relationships Between Two Entities
- 2.12. Creating, Modifying, and Mapping Complex Types
-
3. Querying an Entity Data Model
- 3.1. Executing an SQL Statement
- 3.2. Returning Objects from a SQL Statement
- 3.3. Returning Objects from an Entity SQL Statement
- 3.4. Specifying Fully Qualified Names in Entity SQL
- 3.5. Finding a Master that Has Detail in a Master-Detail Relationship
- 3.6. Setting Default Values in a Query
- 3.7. Returning Multiple Result Sets From a Stored Procedure
- 3.8. Comparing Against a List of Values
- 3.9. Building and Executing a Query Against an ObjectSet<T>
- 3.10. Returning a Primitive Type From a Query
- 3.11. Filtering Related Entities
- 3.12. Applying a Left Outer Join
- 3.13. Ordering by Derived Types
- 3.14. Paging and Filtering
- 3.15. Grouping by Date
- 3.16. Flattening Query Results
- 3.17. Grouping by Multiple Properties
- 3.18. Using Bitwise Operators in a Filter
- 3.19. Joining on Multiple Columns
-
4. Using Entity Framework in ASP.NET
- 4.1. Building a Search Query
- 4.2. Building CRUD Operations in an ASP.NET Web Page
- 4.3. Executing Business Logic When Changes Are Saved
- 4.4. Loading Related Entities
- 4.5. Searching with QueryExtender
- 4.6. Retrieving a Derived Type Using an EntityDataSource Control
- 4.7. Filtering with ASP.NET's URL Routing
- 4.8. Building CRUD Operations with an ObjectDataSource Control
- 4.9. Using Entity Framework With MVC
-
5. Loading Entities and Navigation Properties
- 5.1. Loading Related Entities
- 5.2. Loading a Complete Object Graph
- 5.3. Loading Navigation Properties on Derived Types
- 5.4. Using Include() with Other LINQ Query Operators
- 5.5. Deferred Loading of Related Entities
- 5.6. Filtering and Ordering Related Entities
- 5.7. Executing Aggregate Operations on Related Entities
- 5.8. Testing Whether an Entity Reference or Entity Collection Is Loaded
- 5.9. Loading Related Entities Explicitly
- 5.10. Filtering an Eagerly Loaded Entity Collection
- 5.11. Using Relationship Span
- 5.12. Modifying Foreign Key Associations
-
6. Beyond the Basics with Modeling and Inheritance
- 6.1. Retrieving the Link Table in a Many-to-Many Association
- 6.2. Exposing a Link Table as an Entity
- 6.3. Modeling a Many-to-Many, Self-Referencing Relationship
- 6.4. Modeling a Self-Referencing Relationship Using Table per Hierarchy Inheritance
- 6.5. Modeling a Self-Referencing Relationship and Retrieving a Complete Hierarchy
- 6.6. Mapping Null Conditions in Derived Entities
- 6.7. Modeling Table per Type Inheritance Using a Non-Primary Key Column
- 6.8. Modeling Nested Table per Hierarchy Inheritance
- 6.9. Limiting the Values Assigned to a Foreign Key
- 6.10. Applying Conditions in Table per Type Inheritance
- 6.11. Creating a Filter on Multiple Criteria
- 6.12. Using Complex Conditions with Table per Hierarchy Inheritance
- 6.13. Modeling Table per Concrete Type Inheritance
- 6.14. Applying Conditions on a Base Entity
- 6.15. Creating Independent and Foreign Key Associations
- 6.16. Changing an Independent Association into a Foreign Key Association
-
7. Working with Object Services
- 7.1. Dynamically Building a Connection String
- 7.2. Reading a Model from a Database
- 7.3. Deploying a Model
- 7.4. Using the Pluralization Service
- 7.5. Retrieving Entities from the Object State Manager
- 7.6. Generating a Model from the Command Line
- 7.7. Working with Dependent Entities in an Identifying Relationship
- 7.8. Inserting Entities Using an Object Context
-
8. Plain Old CLR Objects
- 8.1. Using POCO
- 8.2. Loading Related Entities With POCO
- 8.3. Lazy Loading With POCO
- 8.4. POCO With Complex Type Properties
- 8.5. Notifying Entity Framework About Object Changes
- 8.6. Retrieving the Original (POCO) Object
- 8.7. Manually Synchronizing the Object Graph and the Object State Manager
- 8.8. Testing Domain Objects
- 8.9. Testing a Repository Against a Database
-
9. Using the Entity Framework in N-Tier Applications
- 9.1. Deleting an Entity When Disconnected
- 9.2. Managing Concurrency When Disconnected
- 9.3. Finding Out What Has Changed
- 9.4. Using POCO With WCF
- 9.5. Using Self-Tracking Entities With WCF
- 9.6. Validating Self-Tracking Entities
- 9.7. Using Self-Tracking Entities on the Server Side
- 9.8. Serializing Proxies in a WCF Service
- 9.9. Serializing Self-Tracking Entities in the ViewState
- 9.10. Fixing Duplicate References on a WCF Client
-
10. Stored Procedures
- 10.1. Returning an Entity Collection
- 10.2. Returning Output Parameters
- 10.3. Returning a Scalar Value Result Set
- 10.4. Returning a Complex Type from a Stored Procedure
- 10.5. Defining a Custom Function in the Storage Model
- 10.6. Populating Entities in a Table per Type Inheritance Model
- 10.7. Populating Entities in a Table per Hierarchy Inheritance Model
- 10.8. Mapping the Insert, Update, and Delete Actions to Stored Procedures
- 10.9. Using Stored Procedures for the Insert and Delete Actions in a Many-to-Many Association
- 10.10. Mapping the Insert, Update, and Delete Actions to Stored Procedures for Table per Hierarchy Inheritance
-
11. Functions
- 11.1. Returning a Scalar Value from a Model Defined Function
- 11.2. Filtering an Entity Collection Using a Model Defined Function
- 11.3. Returning a Computed Column from a Model Defined Function
- 11.4. Calling a Model Defined Function from a Model Defined Function
- 11.5. Returning an Anonymous Type From a Model Defined Function
- 11.6. Returning a Complex Type From a Model Defined Function
- 11.7. Returning a Collection of Entity References From a Model Defined Function
- 11.8. Using Canonical Functions in eSQL
- 11.9. Using Canonical Functions in LINQ
- 11.10. Calling Database Functions in eSQL
- 11.11. Calling Database Functions in LINQ
- 11.12. Defining Built-in Functions
-
12. Customizing Entity Framework Objects
- 12.1. Executing Code When SaveChanges() Is Called
- 12.2. Validating Property Changes
- 12.3. Logging Database Connections
- 12.4. Recalculating a Property Value When an Entity Collection Changes
- 12.5. Automatically Deleting Related Entities
- 12.6. Deleting All Related Entities
- 12.7. Assigning Default Values
- 12.8. Retrieving the Original Value of a Property
- 12.9. Retrieving the Original Association for Independent Associations
- 12.10. Retrieving XML
- 12.11. Applying Server-Generated Values to Properties
- 12.12. Validating Entities on SavingChanges
-
13. Improving Performance
- 13.1. Optimizing Queries in a Table per Type Inheritance Model
- 13.2. Retrieving a Single Entity Using an Entity Key
- 13.3. Retrieving Entities for Read Only
- 13.4. Improving the Startup Time
- 13.5. Efficiently Building a Search Query
- 13.6. Making Change Tracking with POCO Faster
- 13.7. Compiling LINQ Queries
- 13.8. Returning Partially Filled Entities
- 13.9. Moving an Expensive Property to Another Entity
- 13.10. Avoiding Include
- 13.11. Improving QueryView Performance
- 13.12. Generating Proxies Explicitly
- 13.13. Preventing the Update of All Columns in Self-Tracking Entities
-
14. Concurrency
- 14.1. Applying Optimistic Concurrency
- 14.2. Managing Concurrency When Using Stored Procedures
- 14.3. Reading Uncommitted Data
- 14.4. Implementing the "Last Record Wins" Strategy
- 14.5. Getting Affected Rows from a Stored Procedure
- 14.6. Optimistic Concurrency with Table Per Type Inheritance
- 14.7. Generating a Timestamp Column with Model First
-
15. Advanced Modeling
- 15.1. Creating an Association on a Derived Entity
- 15.2. Mapping an Entity to Customized Parts of One or More Tables
- 15.3. Creating Conditional Associations
- 15.4. Fabricating Additional Inheritance Hierarchies
- 15.5. Sharing Audit Fields Across Multiple Entities
- 15.6. Modeling a Many-to-Many Relationship with Payload
- 15.7. Mapping a Foreign Key Column to Multiple Associations
- 15.8. Using Inheritance to Map a Foreign Key Column to Multiple Associations
- 15.9. Creating Read-only and Computed Properties
- 15.10. Mapping an Entity to Multiple Tables
- 15.11. Mapping an Entity to Multiple Entity Sets (MEST)
- 15.12. Extending Table per Type with Table per Hierarchy
Product information
- Title: Entity Framework 4.0 Recipes: A Problem-Solution Approach
- Author(s):
- Release date: May 2010
- Publisher(s): Apress
- ISBN: 9781430227038
You might also like
book
Professional ADO.NET 3.5 with LINQ and the Entity Framework
Language Integrated Query (LINQ), as well as the C# 3.0 and VB 9.0 language extensions to …
book
Entity Framework 4 in Action
Entity Framework 4 in Action is an example-rich tutorial for .NET developers with full coverage of …
book
Entity Framework 6 Recipes, Second Edition
Entity Framework 6 Recipes provides an exhaustive collection of ready-to-use code solutions for Entity Framework, Microsoft's …
book
Microsoft ADO.NET Entity Framework Step by Step
Your hands-on guide to Entity Framework fundamentals Expand your expertise—and teach yourself the fundamentals of the …