Print Page | Close Window

Where are the EntityManager's "EntitySet" Methods?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1032
Printed Date: 19-Sep-2025 at 10:45am


Topic: Where are the EntityManager's "EntitySet" Methods?
Posted By: smiller
Subject: Where are the EntityManager's "EntitySet" Methods?
Date Posted: 23-Dec-2008 at 12:25pm
Chapter 10 of the IdeaBlade DevForce EF Developer's Guide states that the DevForce EntityManager contains "EntitySet" methods to shuttle business object data between the EntityManager's in-memory entity cache and local storage, namely "SaveEntitySet" and "RestoreEntitySet".  My EntityManager does not have these methods.
 
Poking around I found that the IdeaBlade.Persistence.PersistenceManager contains these methods.  I have an entity that I want to serialize to disk so I thought I'd do something like the following:

var persistenceManager = new IdeaBlade.Persistence.PersistenceManager();

persistenceManager.AddEntity(myEntity);

persistenceManager.SaveEntitySet(filename);

But this code doesn't compile because my entity is not of type IdeaBlade.Persistence.Entity and it cannot be cast to that type.  Is there an example somewhere that shows how to serialize myEntity to disk?

 




Replies:
Posted By: kimj
Date Posted: 23-Dec-2008 at 2:32pm
Sorry that we haven't updated this chapter yet.  The "EntitySet" feature in DevForce Classic is still available in DevForce EF, via the EntityManager.CacheStateManager property.  The reference help does have some sample code under the CacheStateManager class on how to use it:
 
private void SampleEntityCacheUsage() {
 
   DomainModelEntityManager mgr = new DomainModelEntityManager();
 
   // Cache all employees.
   mgr.ExecuteQuery<Employee>();
 
   // Save the cache to local storage.
   mgr.CacheStateManager.SaveCacheState(@"c:\temp\entitycache.bin");
 
   // Occasionally-connected users will normally connect, cache all data required,
   // then disconnect and work from local cache and/or locally saved cache until they can reconnect.
   // In this example, we'll mimic a disconnected login for this user by clearing all cached data
   // and then re-loading the cache from local storage.
   mgr.Disconnect();
   mgr.Clear();
 
   mgr.CacheStateManager.RestoreCacheState(@"c:\temp\entitycache.bin");
 
   // Let's reconnect and get more data now.
   mgr.Connect();
   mgr.ExecuteQuery<Customer>();

 



Print Page | Close Window