Adding multiple same items from one list to another marksold

Adding multiple same items from one list to another marksold

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


eulerthegrape posted on Wednesday, November 12, 2008

I think there is a lapse in my understanding of how a list refers to a list item.  I have two lists call them A and B with the same interface type.  Items can be assigned from list B to list A.  We can have more than one item from list B in list A, which differ in the order within list A.  I have assigned a new Guid to incoming items from list B in a ListAId property.

Here's my issue:  When saving list A it updates previously held items and inserts new ones.  However, if we have added two of the same items to list A (call them sameItem1 and sameItem2) when we insert sameItem1 it is marked as old and sameItem2 is also marked as old so our check to see if the object is new fails and we don't insert the object.

It seems to me that sameItem1 and sameItem2 are not being treated as different objects.  Any thoughts on how to resolve this?

Thanks,
Euler

eulerthegrape replied on Wednesday, November 12, 2008

This may be a kludge-y solution but it seems to work and serve our needs. 

We now implement IClonable in the interface shared by items in list A and B.  Within list A's assignment method we clone the incoming object and then add it to the list.

I don't know if it falls outside CSLA philosophy but it works.

Thanks,
Euler

Copyright (c) Marimer LLC