New Posts New Posts RSS Feed: Where are the EntityManager's "EntitySet" Methods?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Where are the EntityManager's "EntitySet" Methods?

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Where are the EntityManager's "EntitySet" Methods?
    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>();

 
Back to Top
smiller View Drop Down
Newbie
Newbie


Joined: 14-Apr-2008
Location: United States
Posts: 16
Post Options Post Options   Quote smiller Quote  Post ReplyReply Direct Link To This Post 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?

 



Edited by smiller - 23-Dec-2008 at 2:03pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down