Programming Entity Framework: DbContext
Querying, Changing, and Validating Your Data with Entity Framework
Publisher: O'Reilly Media
Final Release Date: February 2012
Pages: 258

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 Tracker API, and validate changes to your data with the Validation API.

With DbContext, you’ll be able to query and update data, whether you’re working with individual objects or graphs of objects and their related data. You’ll find numerous C# code samples to help you get started. All you need is experience with Visual Studio and database management basics.

  • Use EF’s query capabilities to retrieve data, and use LINQ to sort and filter data
  • Learn how to add new data, and change and delete existing data
  • Use the Change Tracker API to access information EF keeps about the state of entity instances
  • Control change tracking information of entities in disconnected scenarios, including NTier applications
  • Validate data changes before they’re sent to the database, and set up validation rules
  • Bypass EF’s query pipeline and interact directly with the database
Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyProgramming Entity Framework: DbContext
 
4.6

(based on 5 reviews)

Ratings Distribution

  • 5 Stars

     

    (4)

  • 4 Stars

     

    (0)

  • 3 Stars

     

    (1)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

100%

of respondents would recommend this to a friend.

Pros

  • Accurate (4)
  • Concise (3)
  • Helpful examples (3)

Cons

    Best Uses

    • Intermediate (4)
    • Expert (3)
      • Reviewer Profile:
      • Developer (4)

    Reviewed by 5 customers

    Sort by

    Displaying reviews 1-5

    Back to top

     
    5.0

    Great and informative!

    By Harry Athey

    from Fort Collins, Co

    About Me Developer

    Verified Reviewer

    Pros

    • Accurate
    • Detailed
    • Easy to understand
    • Insightful

    Cons

      Best Uses

      • Expert
      • Intermediate
      • Novice

      Comments about oreilly Programming Entity Framework: DbContext:

      What a page turner! Couldn't put it down! Yeah, ok that's the kind of things you might hear about a good novel, but seriously the author has taken the deeply technical material and made it very interesting and relevant!

      The detailed handling of the capabilities of dbContext are superb and the examples used made it abundantly clear as to the best uses of the described features. I considered myself pretty knowledgeable with entity framework, but I found a great deal of new information stuffed into this relatively small book.

      The information in the first chapters of the book get the basic user up to speed, while still pointing out tips to the advanced users. Going from the most basic differences between the older methods of using data with the entity framework to the new object description can be helpful to those with experience in the previous versions. I like the trick of setting up the context in a using statement to help to dispose the object.

      The section on LINQ to entities as a good tutorial, but I wish there was a link to a reference on performance versus other methods of querying. Her description of the different methods of loading the object tree was very useful and can be of immediate benefit to most readers. The book illiterates the advantages and disadvantages of each technique in simple terms.

      How EF handled change tacking was a mystery to me, but she clarified the methods used and techniques to enhance performance in a clear manner with great examples.

      The coverage of data validations was likewise technical but written in a very understandable way. The techniques found here will save me time and effort in the future.

      I had been looking for details of how to use the entity framework and dbContext in a disconnected and multi-tier environment and it was covered pretty well in this book although, I would have liked to see more than a couple of paragraphs on WCF Data services in a multi-tier environment.

      I would highly recommend this book for anyone from novice to expert in the use of EF.

      (12 of 12 customers found this review helpful)

       
      3.0

      No index?!

      By lwh

      from Kansas City KS

      Comments about oreilly Programming Entity Framework: DbContext:

      How can you publish a technical book with no index? It's not a novel, it's a reference book.

      (1 of 1 customers found this review helpful)

       
      5.0

      A Great Entity Framework book

      By Greg

      from Germantown, MD

      About Me Developer

      Verified Reviewer

      Pros

      • Accurate
      • Concise
      • Easy to understand
      • Helpful examples
      • Well-written

      Cons

        Best Uses

        • Expert
        • Intermediate

        Comments about oreilly Programming Entity Framework: DbContext:

        This book is a must-have for Entity Framework developers. For those who are already experienced with EF and would prefer to continue using ObjectContext in favor of DbContext, don't worry, ObjectContext is easily accessible when using DbContext.

        The two previous bird books on EF were rather lengthy, and while a useful reference, most developers don't need that level of detail. This book provides just the right amount of information, and focuses on the correct delivery of the most important topics.

        Dealing with disconnected entities receives much better treatment in Entity Framework and this book than in the past.

        The two authors are probably the best candidates for writing this book. They are quite knowledgeable, and deliver with perspective and authority that is sometimes lacking from other writers on the subject.

        Altogether an enjoyable read.

         
        5.0

        A great book not for all

        By Enrico Lorenzo De Vito

        from Italy

        About Me Developer

        Verified Reviewer

        Pros

        • Accurate
        • Concise
        • Helpful examples
        • Well-written

        Cons

        • Difficult to understand

        Best Uses

        • Expert
        • Intermediate

        Comments about oreilly Programming Entity Framework: DbContext:

        This book covers every aspect of the Entity Framework Programming in Visual Studio 2010, specifically on how to use the features of the DbContext, Change Tracker and Validation API, available in the Entity Framework 4.3 release, the authors provides a perfect explanation as to the background for some of the new language features.

        The book is written thinking to the developers which are using Entity Framework in their projects and have, of course, at least some experience in .NET and Database Programming, so if you are a beginner this is not the book for you but if you want to know every advanced techniques of the new API's, this book will be a great resource in your daily work.

        The authors, after a thorough analysis of API DbContext and after dealing with the practical aspects of writing query with LINQ To Entities, focus their attention on the study of the new API's like Change Tracker and Validation, teaching us on every aspects of this technology.

        Then they show us about operations that can be performed with Change Tracker API, including refreshing an entity from the database and other examples about solving common problems with our applications.

        Finally discusses advanced programming problems covering some functionality like Derived Types, Automated Testing and Rargeted Multiple Contexts.

        The examples, mainly written in C #, are easily convertible in VB.NET and are always very clear in every aspect of this book.

        In this book Julia Lerman and Rowan Miller write with a clear and always understandable style also in the most complex aspects of this technology.

        A book to be recommended to those who want to study the more advanced aspects of the Context Db API's and to the programmers or architects who want to implement Entity Framework in their projects.

        (1 of 1 customers found this review helpful)

         
        5.0

        A code-first approach

        By Sumit Bisht

        from Lucknow, India

        About Me Developer

        Verified Reviewer

        Pros

        • Accurate
        • Concise
        • Helpful examples

        Cons

        • Not comprehensive enough

        Best Uses

        • Intermediate

        Comments about oreilly Programming Entity Framework: DbContext:

        The newly released DbContext API is covered succinctly in this book by following a code-first approach. Users hoping for visual studio based visual programming and handling wizards are going to be disappoined, though.
        The book is structured in a format that provides solutions for common problems that any Entity Framework developer comes across while interfacing it with other parts of application.
        The concise nature of the book ensure that only the relevant advice comes in, so it is not for purists or beginners.
        NOTE: I received a copy of this book as part of the Oreilly blogger review program.

        Displaying reviews 1-5

        Back to top

         
        Buy 2 Get 1 Free Free Shipping Guarantee
        Buying Options
        Immediate Access - Go Digital what's this?
        Ebook: $20.99
        Formats:  ePub, Mobi, PDF
        Print & Ebook: $27.49
        Print: $24.99