Freigeben über


Feature CTP Walkthrough: Self Tracking Entities for Entity Framework

 


The information in this post is out of date.

Visit msdn.com/data/ef for the latest information on current and past releases of EF.


 

Overview

The goal of the following walkthrough is to demonstrate a basic scenario for the use of Self Tracking Entities with Entity Framework. Self Tracking Entities is a feature included in the Microsoft Entity Framework Community Technology Preview 1, which consists of a new API added to the ObjectContext and ObjectSet classes (implemented as extension methods for the Feature CTP) and a code-generation template based on Text Template Transformation Toolkit (T4) technology included in Visual Studio.

Self Tracking Entities are domain classes that do not have any dependency on Entity Framework but include mechanisms that allow them to track changes on scalar and complex property values, references and collections within themselves, independently of the Entity Framework.

The first scenario we are trying to address with Self Tracking Entities is one in which a WCF service exposes a series of operations that return entity graphs, then a client application can manipulate that graph and submit the modifications to a service operation that validates and performs the updates to a database store using Entity Framework.

Requirements

  1. This walkthrough requires Visual Studio 2010 Beta 1
  2. The Microsoft Entity Framework Feature CTP1, that can be downloaded from here.
  3. A local SQL Server 2008 Express instance has to be installed as SQLEXPRESS. Otherwise, changes to the connection string in the web.config file or regenerating the database from the included SQL scripts may be necessary.
  4. Download and extract the initial solution attached to this post.

Read More...

SelfTrackingEntitiesWalkthrough.zip

Comments

  • Anonymous
    June 22, 2009
    PingBack from http://aspmvc.co.cc/2009/06/22/feature-ctp-walkthrough-self-tracking-entities-for-entity-framework/

  • Anonymous
    June 22, 2009
    Thank you for submitting this cool story - Trackback from progg.ru

  • Anonymous
    June 22, 2009
    Avec VS 2010 Beta 1, il manquait quelque features pour lesquelles l’EF team avait communiqué en disant

  • Anonymous
    July 19, 2009
    Thank you for submitting this cool story

  • Anonymous
    July 31, 2009
    I make a test for this Walkthrough by using code only Context, and i receive this error "underlying connection was closed: The connection was closed unexpectedly" I think that there is an incompatobility when use T4 SelftTracking with CodeOnly approche. unfortunately it's an other limitation of EF

  • Anonymous
    August 06, 2009
    Will the new Entity Framework designer support Entity Framework + BaseEntity class model? Can somebody answer the question in this thread? http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/038d14e8-fc04-4b06-b1e4-d5b1a950a901 Thanks!

  • Anonymous
    August 31, 2009
    The comment has been removed

  • Anonymous
    September 04, 2009
    The comment has been removed

  • Anonymous
    November 11, 2009
    When will this walkthrough be adapted for CTP 2?

  • Anonymous
    November 13, 2009
    Hi   I'm trying the shelftracking entities and i have notice that when we call the method  entity.AcceptChanges() it doesn't propagate the AcceptChanges to the child entities and when we make changes to a child entity the parent entity isn't warned that something has changed, is this normal or is it bug. Many thanks JC