Hi all,
I have a CartEntity object with a collection if CartDetailEntities (cart.CartDetails).
If I run this code:
public static int DeleteItems(CartEntity cart, List<int> itemIds)
{
int deleteCount = 0;
for(int i = 0 ; i < cart.CartDetails.Count ; i++ )
{
if (itemIds.Contains(cart.CartDetails[i].CartDetailId))
{
cart.CartDetails[i].Delete();
deleteCount++;
}
}
return deleteCount;
}
Note: CartDetailEntity is part of a TargetPerEntity hierarchy, which is why I'm not using DeleteMulti().*
I notice that the CartDetailEntitys are deleted from the database but remain in the cart.CartDetails in-memory collection.
Is there anyway I can get the system to both delete the item from the database and remove it from the in-memory collection?
thanks,