Search   

Sunday, February 05, 2012

Support » Support Forum

Register  Login

 Menu  
 
    

 Welcome!  
 


Welcome to the NDO support forum!

kreis.gif Please register/login at the site if you want to post a thread. We sometimes copy support mails of common interest to the forum. They appear with anonymous sender.
kreis.gif Please post your messages in English language if possible. You can do your posts also in German, we will translate your post and our answer so that all users of the forum can read your posts.
kreis.gif The forum software requires that javascript is enabled.
kreis.gif Please do not insert licence information or licence keys in forum posts.
kreis.gif If you know a good answer to a post of another user, feel free to reply!
kreis.gif The forum is monitored. We reserve the right to remove posts we consider not to be useful for other forum users.

   Print   

      
 NDO Support Forum  
 
SearchForum Home
  NDO-Forum postings in english please, if possible.  Developing with NDO  Collision not d...
 Collision not detected with hollow objects
 
 10/11/2006 12:38:52 PM
anonymous
20 posts


Collision not detected with hollow objects
 Modified By Mirko  on 10/11/2006 12:42:24 PM)

Hi all,
I have the following code using TimeStamps with the Employee class:

PersistenceManager pm1 = new PersistenceManager();
PersistenceManager pm2 = new PersistenceManager();
pm2.CollisionEvent += new CollisionHandler(MyCollisionEventHandler);

// Loading same object twice as hollow object
Employee e1 = pm1.NewQuery(typeof(Employee), "firstName = 'ExistingName'").ExecuteSingle as Employee;
Employee e2 = pm2.NewQuery(typeof(Employee), "firstName = 'ExistingName'").ExecuteSingle as Employee;

e1.FirstName = "NewName";
pm1.Save();

e2.FirstName = "NewName2";
pm2.Save(); // Should cause a Collision, but it doesnt occur.

If I change the queries to load the objects as non-hollow objects, the collision event occurs as expected.
It this a bug or a feature ?

cheers - a.

 10/11/2006 12:50:34 PM
Mirko
109 posts
5th


Re: Collision not detected with hollow objects

Hi A,
thanks for your question.

NDO behaves correct. The TimeStamp is loaded at the time, the object is loaded and not at the query time. Because of the loading-on-demand feature the object e1 is loaded at the moment you manipulate it and saved right after that.

e2 is loaded at the moment it is manipulated - that's after saving e1. It loads 'NewName' and overwrites it with 'NewName2'. So, there is no collision happening.

If you changed the order of your statements like that:

e1.FirstName = "NewName";
e2.FirstName = "NewName2";

pm1.Save();
pm2.Save();

you'd get the collision and the collision event is fired.

Best Regards
Mirko

  NDO-Forum postings in english please, if possible.  Developing with NDO  Collision not d...
  SearchSearch  Forum HomeForum Home