deleting relations and related entities

Posts   
 
    
JLSaaltink
User
Posts: 1
Joined: 27-Jun-2017
# Posted on: 27-Jun-2017 17:28:20   

Hi,

Because of an NDA I can only provide you with a scenario:

The Data access is exposed through a WCF Service, which uses LLBLGen to access the database. An entity, Building, has a collection of other entities, Tenants. Adding the tennants to the building, then saving works fine. However when I remove the tennants from the building in the client, then post the Building to be saved, the change is not stored in the database. The Building entity arrives properly in the service without the removed tenants

When I look at the documentation for deleting records here https://www.llblgen.com/documentation/5.0/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/gencode_usingentityclasses_deleting.htm

I see that I would have to fetch the old related tennants first. Check which are missing, then delete them. Besides that would be deleting the entire entity, which in this case is valid, but knowing how to delete only the relation would be good too.

Is there some functionality I'm missing? What methods/configuration would I need to use?

Version: LLBLGen Pro v5.0 RTM (5.0.5) Runtime Version: 4.2.14.701 Template group: (I think adapter (I'm maintaining code written by another party), but the DataAccessAdapter is generated) .NET Framework 4

¬ Kind regards

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 27-Jun-2017 23:57:15   

No need for that, entities removed from the related collection can be tracked and deleted from the database when needed. Please check Tracking entity remove actions