Hello everyone! Does anybody know if there are any solution like 'Hibernate History API' for entity framework. If no, may be there are some history tracking practise/patterns applied to EF. I'm newbie to EF so far. Any refs are welcome. Thanks in advance.
+3
A:
EF version 4 has Self Tracking Entities. They track their changes and can be attached back to a different context to be saved. http://msdn.microsoft.com/en-us/library/dd456853.aspx
This is new to EF. The first version did not have this functionality.
Dan H
2010-08-04 13:13:16
I don't need diff context. I mean that i need snapshot of the object's previous state. If i going to STE then i lose some features such as lazy loading and others.
AndrewG
2010-08-05 11:46:45
Furthermore, It's just another one implementation for the generation of the objects with built-in abilities to track changes in most for remoting. My question was if there are some features in EF akin to 'Hibernate History API' http://labs.micromata.de/display/hh/Home with handy APIs to track changes. Or may be there are some third party providers.Anyway thanks.
AndrewG
2010-08-05 12:13:36
A:
There is also ObjectContext.SavingChanges. You can handle this and then walk the modified/etc. members in ObjectStateManager
.
Craig Stuntz
2010-08-04 15:48:28
A:
If you are asking for a roll back feature then it is not supported. However you have the option to retrieve the original and current value of a property and relationship. For instance for customer i would do this
db.ObjectStateManager.GetObjectStateEntry(customer).CurrentValues["Name"] db.ObjectStateManager.GetObjectStateEntry(customer).Original["Name"]
zeeshanhirani
2010-08-05 01:37:20