Book description
Entity Framework 6 Recipes provides an exhaustive collection of ready-to-use code solutions for Entity Framework, Microsoft's model-centric, data-access platform for the .NET Framework and ASP.NET development. 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
Places strong focus on DbContext and the Code First approach
Covers new features such as Asynch Query and Save, Codebased Configuration, Connection Resiliency, Dependency Resolution, and much more
What you'll learn
Implement basic data access design patterns using Entity Framework.
Seamlessly model your solutions across both code and data.
Provide data access to Windows 8 and Metro applications.
Integrate with WCF Data Services
Improve data access performance.
Simplify and reduce your code through data binding.
Who this book is for
Entity Framework 6 Recipes is for anyone learning Microsoft's Entity Framework—Microsoft's primary data access platform in the .NET Framework. If you have ever struggled to learn a new technology, programming model, or way of doing something, you know how helpful simple and real-world examples can be. For the beginning developer, this book provides concrete examples for common data access tasks. For developers having experience with previous Microsoft data access platforms, this book provides a task-by-task mapping between previous approaches and the patterns used in Entity Framework.
Table of contents
- Title Page
- Dedication
- Contents at a Glance
- Contents
- About the Authors
- About the Technical Reviewer
- Preface
- CHAPTER 1: Getting Started with Entity Framework
-
CHAPTER 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 with a Code-First Approach
- 2-6. Splitting an Entity Among Multiple Tables
- 2-7. Splitting a Table Among 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
-
CHAPTER 3: Querying an Entity Data Model
- 3-1. Querying Asynchronously
- 3-2. Updating with Native SQL Statements
- 3-3. Fetching Objects with Native SQL Statements
- 3-4. Querying a Model with 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. Filtering Related Entities
- 3-10. Applying a Left-Outer Join
- 3-11. Ordering by Derived Types
- 3-12. Paging and Filtering
- 3-13. Grouping by Date
- 3-14. Flattening Query Results
- 3-15. Grouping by Multiple Properties
- 3-16. Using Bitwise Operators in a Filter
- 3-17. Joining on Multiple Columns
- CHAPTER 4: Using Entity Framework in ASP.NET MVC
-
CHAPTER 5: Loading Entities and Navigation Properties
- 5-1. Lazy Loading Related Entities
- 5-2. Eager Loading Related Entities
- 5-3. Finding Single Entities Quickly
- 5-4. Querying In-Memory Entities
- 5-5. Loading a Complete Object Graph
- 5-6. Loading Navigation Properties on Derived Types
- 5-7. Using Include( ) with Other LINQ Query Operators
- 5-8. Deferred Loading of Related Entities
- 5-9. Filtering and Ordering Related Entities
- 5-10. Executing Aggregate Operations on Related Entities
- 5-11. Testing Whether an Entity Reference or Entity Collection Is Loaded
- 5-12. Loading Related Entities Explicitly
- 5-13. Filtering an Eagerly Loaded Entity Collection
- 5-14. Modifying Foreign Key Associations
-
CHAPTER 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 Nonprimary Key Column
- 6-8. Modeling Nested Table per Hierarchy Inheritance
- 6-9. Applying Conditions in Table per Type Inheritance
- 6-10. Creating a Filter on Multiple Criteria
- 6-11. Using Complex Conditions with Table per Hierarchy Inheritance
- 6-12. Modeling Table per Concrete Type Inheritance
- 6-13. Applying Conditions on a Base Entity
- 6-14. Creating Independent and Foreign Key Associations
- 6-15. Changing an Independent Association into a Foreign Key Association
-
CHAPTER 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 Change Tracker
- 7-6. Generating a Model from the Command Line
- 7-7. Working with Dependent Entities in an Identifying Relationship
- 7-8. Inserting Entities Using a Database Context
- 7-9. Querying and Saving Asynchronously
-
CHAPTER 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 Change Tracker
- 8-8. Testing Domain Objects
- 8-9. Testing a Repository Against a Database
-
CHAPTER 9: Using the Entity Framework in N-Tier Applications
- 9-1. Updating Single Disconnected Entities with the Web API
- 9-2. Updating Disconnected Entities with WCF
- 9-3. Finding Out What Has Changed with Web API
- 9-4. Implementing Client-Side Change Tracking with Web API
- 9-5. Deleting an Entity When Disconnected
- 9-6. Managing Concurrency When Disconnected
- 9-7. Serializing Proxies in a WCF Service
-
CHAPTER 10: Stored Procedures
- 10-1. Returning an Entity Collection with Code Second
- 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
-
CHAPTER 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
-
CHAPTER 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 Saving Changes
-
CHAPTER 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 Access
- 13-4. Efficiently Building a Search Query
- 13-5. Making Change Tracking with POCO Faster
- 13-6. Auto-Compiling LINQ Queries
- 13-7. Returning Partially Filled Entities
- 13-8. Moving an Expensive Property to Another Entity
- 13-9. Avoiding Include
- 13-10. Generating Proxies Explicitly
-
CHAPTER 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
- Index
Product information
- Title: Entity Framework 6 Recipes, Second Edition
- Author(s):
- Release date: October 2013
- Publisher(s): Apress
- ISBN: 9781430257882
You might also like
book
Entity Framework 4 in Action
Entity Framework 4 in Action is an example-rich tutorial for .NET developers with full coverage of …
book
Programming Entity Framework, 2nd Edition
Get a thorough introduction to ADO.NET Entity Framework 4 -- Microsoft's core framework for modeling and …
book
Programming Entity Framework: DbContext
The DbContext API captures Entity Framework’s (EF) most commonly used features and tasks, simplifying development with …
book
Programming Entity Framework: Code First
Take advantage of the Code First data modeling approach in ADO.NET Entity Framework, and learn how …