Delete EntityBase2

Posts   
 
    
Posts: 5
Joined: 13-Oct-2010
# Posted on: 31-Jan-2011 15:21:29   

I want to delete an entity of base type EntityBase2. On entities of base type EntityBase I can call a delete method, but this method is not available on entities of type EntityBase.

I'm also not able to call the DeleteMulti Method on the removed entities tracker: ((ShopEntity)this.CurrentData.Detail).ShopGenders.RemovedEntitiesTracker.DeleteMulti();

Thanks in advance for the help!

Dimitri

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 31-Jan-2011 15:41:48   

EntityBase2 is adapter, EntityBase is selfservicing. What are you using: selfservicing or adapter?

Frans Bouma | Lead developer LLBLGen Pro
Posts: 5
Joined: 13-Oct-2010
# Posted on: 31-Jan-2011 16:43:55   

I'm using Adapter.

I have an entity having a property of type collection containing other entities. From this collection i want to delete some entities. Just calling the remove method on the collection doesn't work, since I just remove it in memory but not from the database.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 31-Jan-2011 17:10:47   

DimitriSturm wrote:

I'm using Adapter.

I have an entity having a property of type collection containing other entities. From this collection i want to delete some entities. Just calling the remove method on the collection doesn't work, since I just remove it in memory but not from the database.

In adapter, database activity is executed through the adapter. So, the easiest for you is simply creating a UnitOfWork2 instance, and add the entities you want to delete to that using AddForDelete() and then call unitofworkinstance.Commit(adapter, true);

You can also call adapter.DeleteEntity(entity). (see manual). The documentation is your friend wink

Frans Bouma | Lead developer LLBLGen Pro