Programming Entity framework: Dbcontext

The DbContext API captures Entity Framework's (EF) most commonly used features and tasks, simplifying development with EF. This concise book shows you how to use the API to perform set operations with the DbSet class, handle change tracking and resolve concurrency conflicts with the Change Trac...

Full description

Bibliographic Details
Main Author: Lerman, Julia
Other Authors: Miller, Rowan
Format: eBook
Language:English
Published: Sebastopol, CA O'Reilly Media 2012
Edition:1st ed
Subjects:
Online Access:
Collection: O'Reilly - Collection details see MPG.ReNa
Table of Contents:
  • Ensuring DbContext Instances Get DisposedChapter 2. Querying with DbContext; Writing Queries with LINQ to Entities; Querying All the Data from a Set; Using LINQ for Sorting, Filtering, and More; Finding a Single Object; Querying Local Data; Using the Load Method to Bring Data into Memory; Running LINQ Queries Against Local; Working with the ObservableCollection Returned by Local; Loading Related Data; Lazy Loading; Understanding the downsides of lazy loading; Eager Loading; Understanding the downsides of eager loading; Using Include in LINQ queries; Explicit Loading
  • Checking If a Navigation Property Has Been LoadedQuerying Contents of a Collection Navigation Property; Explicit Loading a Subset of the Contents of a Navigation Property; Chapter 3. Adding, Changing, and Deleting Entities; Working with Single Entities; Adding New Entities; Changing Existing Entities; Deleting Existing Entities; Deleting without loading from the database; Deleting an object with related data; Multiple Changes at Once; The "Find or Add" Pattern; Working with Relationships; Adding a Relationship Between Objects; Changing a Relationship Between Objects
  • Table of Contents; Preface; Audience; Contents of This Book; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1. Introducing the DbContext API; Getting the DbContext API into Your Project; Looking at Some Highlights of the DbContext API; Reducing and Simplifying Ways to Work with a Set; Retrieving an Entity Using ID with DbSet.Find; Avoiding Trolling Around the Guts of Entity Framework; Working with the BreakAway Model; Getting the Sample Solution; Getting DbContext from an EDMX Model
  • Removing a Relationship Between ObjectsWorking with Change Tracking; Using Snapshot Change Tracking; Understanding When Automatic Change Detection Occurs; Controlling When DetectChanges Is Called; Using DetectChanges to Trigger Relationship Fix-up; Enabling and Working with Change Tracking Proxies; Ensuring the New Instances Get Proxies; Creating Proxy Instances for Derived Types; Fetching Entities Without Change Tracking; Chapter 4. Working with Disconnected Entities Including N-Tier Applications; A Simple Operation on a Disconnected Graph; Exploring the Challenges of N-Tier
  • Using Existing N-Tier Frameworks That Support Graph ModificationUsing Explicit Operations on the Server Side; Replaying Changes on the Server; Understanding How DbContext Responds to Setting the State of a Single Entity; Marking a New Entity as Added; Marking an Existing Entity as Unchanged; Marking an Existing Entity as Modified; Registering an Existing Entity for Deletion; Using a stub entity to mark for deletion; Working with Relationships with and Without Foreign Keys; Benefiting from foreign key properties; Using navigation properties to define relationships