AcceptChanges of BusinessBaseList doesn't remove delete objects from DeletedList collection

AcceptChanges of BusinessBaseList doesn't remove delete objects from DeletedList collection

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


oshokodk posted on Thursday, August 17, 2006

AcceptChanges method of BusinessListBase doesn't remove deleted objects from DeletedList collection. The following fragment of AcceptCahnges checks EditLevelAdded proprety before deleting an object from collection. Objects loaded from DB never get deleted. They just sit in DeletedList collection until end of BusinessListBase lifespan.

for (int index = DeletedList.Count - 1; index >= 0; index--)

{

      C child = DeletedList[index];

      child.AcceptChanges();

      // if item is below its point of addition, remove

      if (child.EditLevelAdded > _editLevel)

            DeletedList.RemoveAt(index);

}

I think check should be  if (child.EditLevelAdded  >= _editLevel). 

Is this is a bug or  am I doing anything wrong?

RockfordLhotka replied on Saturday, August 19, 2006

They must remain in DeletedList until after the Save() operation - otherwise you'd never know which items to delete during the data access process. Only newly added and then deleted items are ever removed from the collection entirely.

oshokodk replied on Monday, August 21, 2006

At what time are "old" but deleted items removed from DeletedList collection? Only 2 methods remove object from  DeletedList : UndoChanges and AcceptChanges. Both of them however perform check

if (child.EditLevelAdded > _editLevel)

I don't see DeletedList collection being cleared either.

At what time are "old" but deleted items removed from DeletedList collection? 

 

Thanks,

Oleg Shokodko

ajj3085 replied on Monday, August 21, 2006

Old items are cleared when you save the collection.  You have to code this yourself.

Copyright (c) Marimer LLC