New Posts New Posts RSS Feed: Why do all temporary ID's get fixed up, not just the ones being saved?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Why do all temporary ID's get fixed up, not just the ones being saved?

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: Why do all temporary ID's get fixed up, not just the ones being saved?
    Posted: 12-Jul-2007 at 3:29pm
I have created X number of entities and added each one to the PersistenceManager.  When I go to save one of any of them, all entites have an ID generated for them but are not saved.  Why is that the case?  Is there any way around that?
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2007 at 3:29pm
IdeaBlade / DevForce has always resolved all temp ids when a save begins, even for entities that you are not saving. I wrote extensively on this subject recently because - for reasons mysterious to me - there has been a sudden flurry of questions about this. Apparently, more and more folks are tempted to save some but not all of the entities with pending changes/additions/deletions. We discourage this because there are data integrity risks. Saving some but not all of the entities can result in violations of cross-object business rules and lead to inconsistencies that are hard to detect and repair.
 
That said, many customers want to do it anyway and are further disturbed that we are resolving all temp ids instead of just those of the new entities being saved. Again, in principle, no one should care about the primary keys. They are supposed to hold arbitrary values with no intrinisic meaning. But, of course, customers sometimes feel differently - they don't want to see gaps in the id sequence for example.
 
Accordingly, and somewhat at odds with our better judgement, we are going to change our 4 year old practice of resolving all temp ids and allow the fixxing up of only the new entities being saved.  This will be done with a FixUpTempIds property in the SaveOptions class.  Possible enumerated values are All or InSaveListOnly
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down