Snapshot support
What is preserved?
Snapshot can be taken from the entire entity context. Enity context is a persistent store of
the entities. The state of the entity context consists of all the entities it contains.
Taking snapshots and reverting
Entify framework provides snapshot feature to save the current state of the persistent store.
Taking a snapshot is as easy as calling the TakeSnapshot() method of the EntityContext object.
This call copies the whole persistent store to another file and returns the snapshot identifier
that can be used later to revert to the preserved state of the entity context. It's possible
to take multiple snapshots from entity context and revert to them in any order required
by the application. Revert is done by calling the RevertToSnapshot() with the correct
snapshot identifier.
Cleaning snapshots
Since the snapshots are files on the filesystem, host application should remove snapshots when it's
certain that they aren't needed anymore. Removing a snapshot can be done as easily as taking one,
just call the RemoveSnapshot() method of the EntityContext and the snapshot is gone for good!
|