Sunday, February 05, 2012
Support » Support Forum
Register Login
HomeWhat is NDO?- Executive Overview- NDO for DevelopersHow NDO Works- Persistent Classes- Mapping- Queries- Reverse Engineering- Inheritance, Polymorphism- Distributed ApplicationsLicensingSupport- Support Forum- FAQ- Solutions- Downloads- E-Mail Support- Tutorial VideosOnline ShopContact
Welcome to the NDO support forum!
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. 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. The forum software requires that javascript is enabled. Please do not insert licence information or licence keys in forum posts. If you know a good answer to a post of another user, feel free to reply! The forum is monitored. We reserve the right to remove posts we consider not to be useful for other forum users.
Hi!I use this code to update a persistent object:PersistenceManager pm = new PersistenceManager();pm.MakePersistent(odlSalutationLetter);pm.Save();After pm.Save() I get this exception:MakePersistent: Object is already persistent: [Type = ...|Id = ...]"Source="NDO"...
I use NDO Professional version 1.2.0.0.What have I done wrong?Best Regards,Marc Haid
Hi Marc,
updating an object simply requires calling Save().
MakePersistent is only used to store an object in the first place, thus making it persistent.
If you change a persistent object, the object marks itself as Dirty and NDO updates the data row during the next call to Save().
I hope, that helps!
Best Regards:Mirko
creating and changing an object are two different scenarios.
1. Creating:
Employee e = new Employee();// Setting the properties occurs // the UIe.FirstName = "Mirko";e.LastName = "Matytschak";pm.MakePersistent(e);pm.Save();
2. Changing
// e might be retrieved by a query// Setting the properties normally// occurs in the UIe.FirstName = "Johnny";e.LastName = "Winter";pm.Save();// new state of e is in the database
Have a look at our Tutorial application to see, how these things work.
Best RegardsMirko