New Posts New Posts RSS Feed: Saving Cache using IEnumerable pDataRows
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedSaving Cache using IEnumerable pDataRows

 Post Reply Post Reply
Author
DocScooter View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 7
Post Options Post Options   Quote DocScooter Quote  Post ReplyReply Direct Link To This Post Topic: Saving Cache using IEnumerable pDataRows
    Posted: 03-Jul-2007 at 5:28am
I think I would like to save a subset of the cache using the SaveEntitySet(ByVal pDataRows As IEnumerable, ByVal pFileName As string) overload.  But there is no clear example I have found in the tutorials or Developers Guide to develop the pDataRows in the DevForce context.  Maybe it's there and I just haven't found it or I don't know what to look for....
 
Can you post something that might enlighten me...please.  Thanks.
 
DocScooter
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jul-2007 at 10:17am
You can create a new PersistenceManager.  Then use ImportEntities to import the entities from one PersistenceManager to another.
 
Here is a code snippet which copies all changed Employees from one PersistenceManager to another.
 
       mPmLegacy = new PersistenceManager(true, "Legacy");
      mPmLegacy.ImportEntities(mPM.GetEntities<Employee>(DataRowState.Modified | DataRowState.Added | DataRowState.Deleted), MergeStrategy.PreserveChanges);
  
Back to Top
DocScooter View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 7
Post Options Post Options   Quote DocScooter Quote  Post ReplyReply Direct Link To This Post Posted: 03-Jul-2007 at 1:02pm
Thanks, David.  So far so good.  Can I restore the EntitySet to any PersistanceManager or do I have to restore and then import?
 
What I am trying to do is store reference tables locally so that I will minimize network traffic since bandwidth and network traffic is an issue.  Once I have the tables locally I will just have to worry about the changes and that should be relatively easy to accomplish....
 
Thanks again and have a GREAT Independance Day!
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jul-2007 at 8:16am
Scott,
 
Yes.  You can restore the EnitySet to any PersistenceManager.
 
David
Back to Top
DocScooter View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 7
Post Options Post Options   Quote DocScooter Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jul-2007 at 11:12am
Thumbs%20Up  Works Slick! 
 
I got a DB error when I disconnected until I used the call PersistanceManager.Disconnect()
 
 
Happy Fourth.....
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down