Order of updating a list

Order of updating a list

Old forum URL: forums.lhotka.net/forums/t/12215.aspx


vandenbergjp posted on Monday, November 11, 2013

Hi,

In all example DAL code I have seen for updating a list: first the deleted items and then the regular items are processed. I was wondering if this order is important.

The reason I ask this is because I have a situation where I would like to copy information associated with the deleted items to certain new items in the list. The associated information can be rather large and only exist in the database and not in memory.

Thanks,

 

JonnyBee replied on Monday, November 11, 2013

Hi, 

When you update items in a list you often have primary / unique keys in the database and could possibly have both deleted and added new items with the same unique key(s).

That is why the deleted items is always deleted first - and then the list items is updated/inserted. 

 

vandenbergjp replied on Tuesday, November 12, 2013

Thanks JonnyBee. My primairy keys are autoincremented in SqlServer and are using a sequence in Oracle so I don't think that will cause a problem in my case.

Copyright (c) Marimer LLC