C#:
void SaveEntitySet(String pFileName);
void SaveEntitySet(IEnumerable pDataRows, String pFileName);
void SaveEntitySet(Stream pStream, bool pCloseOnExit);
void SaveEntitySet(IEnumerable
pDataRows, Stream pStream,
bool
pCloseOnExit);
VB.NET:
Sub SaveEntitySet(pFileName as String)
Sub SaveEntitySet(pDataRows as IEnumerable, pFileName as String)
Sub SaveEntitySet(pStream as Stream, pCloseOnExit as Boolean)
Sub SaveEntitySet(pDataRows as IEnumerable, pStream as Stream, _
pCloseOnExit
as Boolean)
SaveEntitySet can
preserve the entire entity cache or just some selected objects. The
destination file may reside anywhere in the local file
system although it is often wise to save to the user's "Isolated
Storage". The "stream" signatures facilitate piping
the data through intermediate filters before they get to their ultimate
destination. For example, we might want to flow object data through
an encryption filter before storing them. We can also append custom
bytes to the same stream if you're up to managing that yourself.
When the user re-launches the application, it should locate the saved
file (or stream) and restore its contents to the PersistenceManager’s entity
cache, using one of the following methods.
C#:
void RestoreEntitySet(String pFileName);
void RestoreEntitySet(String pFileName, RestoreStrategy pStrategy);
void RestoreEntitySet(Stream
pStream, RestoreStrategy pStrategy,
bool
pCloseOnExit);
VB.NET:
Sub RestoreEntitySet(pFileName as String)
Sub RestoreEntitySet(pFileName as String, pStrategy as RestoreStrategy)
Sub RestoreEntitySet(pStream as Stream, pStrategy as RestoreStrategy,
_
pCloseOnExit
as Boolean)
The RestoreStrategy parameter prescribes how to handle entity set
objects that already exist in the target PersistenceManager’s cache. The default RestoreStrategy preserves
the cache's pending business objects changes – additions, modifications,
and deletions.
When the application obtains a server connection, it can synchronize
local objects with the remote data source. It can save local pending
changes, relying upon DevForce optimistic concurrency checking to prevent
overwriting other users’ changes. It might refresh local copies
of business objects with objects updated by other users previously.
Remember: the application must pre-fill the cache with entities the
user will need offline before saving the cache and disconnecting. While
disconnected, queries and object navigation can only access cached
entities.