New Posts New Posts RSS Feed: Caching of entities to be saved
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Caching of entities to be saved

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

Joined: 26-Jan-2012
Posts: 1
Post Options Post Options   Quote cocog Quote  Post ReplyReply Direct Link To This Post Topic: Caching of entities to be saved
    Posted: 02-Feb-2012 at 8:26am
Our SL screen will allow the user to create new Owner entities.  The owner entity has an identity column for it's primary key in the database.  We also capture the time the entity was instantiated by the entity manager (e.g. when the class was created, not saved to the db).  We save all additions/modification using "SaveChangesAsync."  

Occasionally, we will get records in the database that show the records are not saved in the order they were created.  For example:

Owner 1 (created first):
ID: 1001
Instantiated: 10:02 AM

Owner 2 (created second):
ID: 1000
Instantiated: 10:05 AM

SaveChangesAsync was called after each owner was created. 

Why would Owner 1 not be saved to the db until after Owner 2, 3 minutes later?

Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 02-Feb-2012 at 1:19pm
Hi cocog,

The order in which asynchronous operations execute and complete is non-deterministic. If you want to control the save order in SL, you can:


2. Or use Serial Coroutine to suspend the second SaveChangesAsync call until the first one completes. See http://drc.ideablade.com/xwiki/bin/view/Documentation/coroutines

Hope this answers your questions.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down