Removing entities from collection

Posts   
 
    
Posts: 5
Joined: 13-Oct-2010
# Posted on: 27-Oct-2010 15:38:46   

I want to add en remove entities from an entity collection of an other entity. I use the following line of code to adde entities en this works fine, my entity is added en the relation is created in the database:

((ShopEntity)this.CurrentData.Detail).ShopSegments.Add(new ShopSegmentEntity() { SegmentType = segmentType });

To remove an item i use the following line of code, and this doesn't work:

((ShopEntity)this.CurrentData.Detail).ShopSegments.RemoveAt(i);

How can i remove an item from the collection?

Kind regards,

Dimitri sturm

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Oct-2010 15:59:14   

Do you mean the entity is not removed from the collection in memory? Or it is removed from the collection but when you save the collection these removed entities are not deleted from the database?