Question

What is the difference between using Entity framework self tracking entities and implementing Unit of work architecture? As i understand both are keep tracking of the objects, one db call for commit changes. So i cant figure out the difference of those. can some one point me about what should used in which case? I'm using entity framework 5 with WCF service application.

Was it helpful?

Solution 2

According to the MSDN, Self Tracking Entities are no longer Recommended

STEs No Longer Recommended

We no longer recommend using the STE template, it continues to be available to support existing applications. Visit the N-Tier page for other options we recommend for N-Tier scenarios.

http://msdn.microsoft.com/en-us/data/jj613924.aspx

OTHER TIPS

The purpose of self tracking entities is that you don't need to keep the DbContext/ObjectContext alive to track changes to the entity object(s). The main feature of this is you can send an entity to another process (or host entirely, such as another WCF service on another host) that makes changes to the entity object, then returns that entity object to the calling process with change tracking still intact.

UoW coordinates changes made between multiple entity objects (greatly simplified explanation).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top