locked
Why do we need Self-Tracking Entities? RRS feed

  • Question

  • Hi,

    I am leanring on VS2010, .net 4 and ef 4.0

    I am trying to understand, when EntityObject has capabilities of State like deattached, Unchanged, Added etc. which means it can track it changes, also If i serialize entityobject won;t State properties also be serialize?

    Then why do we need Self-Tracking Entities?

    Regards

    Wednesday, December 19, 2012 2:04 PM

Answers

All replies

  • Hello JiyaDesai,

    The Self-Tracking Entities (STE) were used mainly in multi-tier applications, where a client program would have to fetch data from a service or web service into memory and then manipulate that data (by adding new entities, modifying fetched entities, deleting entities) in memory so that every of these operations won't have to communicate directly with the database, which would slow down the process if the database is somewhere else on the internet, or on any other network.

    The Self-Tracking Entities have an internal mechanism to keep track of what have been changed into memory when it's time to upload them back into the database.

    Note that the Self-Tracking Entities are now deprecated in favor of the DBContext API which was introduced in Entity Framework 4.1 :
    http://msdn.microsoft.com/en-us/data/gg192989.aspx

    The DBContext API supports working with detached entities just like the Self-Tracking Entities did.



    Wednesday, December 19, 2012 2:33 PM
  • Hi,

    Wow, deprecated.  This is news to me.  Nice so i can skip all articles around it.

    Well then is there any article/link that describes how to use WCF and DBContext API  to achieve same instead of Self-Tracking Entities.

    (The above link take to the page which says "The information in this post is out of date" )

    Regards

    Wednesday, December 19, 2012 5:20 PM
    • Marked as answer by Alexander Sun Wednesday, December 26, 2012 3:04 AM
    Wednesday, December 19, 2012 6:27 PM