DeleteEntitiesDirectly not working

Posts   
 
    
gfrankol
User
Posts: 10
Joined: 10-Apr-2017
# Posted on: 11-Aug-2017 15:21:08   

Hello,

I'm using LLBLGenPro designer v 4.2 Final November 29th, 2016 Template group: Adapter Target Framework: LLBLGen Pro Runtime Framework Target Language: C# Target platform: .Net 4.6

The database is Oracle 12c. Using oracle instant client 11.1 and Oracle MS driver.

We upgraded the project from 2.5. to 2.6. and then to 4.2.

After the upgrade the DataAccessAdapter DeleteEntitiesDirectly function is not working for tables that have no PK. We have tried the combinations:

adapter.DeleteEntitiesDirectly(typeof(CrmSourceStarVinfilterEntity), new RelationPredicateBucket(CrmSourceStarVinfilterFields.Vin == "123"));
adapter.DeleteEntitiesDirectly(typeof(CrmSourceStarVinfilterEntity), new RelationPredicateBucket());
adapter.DeleteEntitiesDirectly(typeof(CrmSourceStarVinfilterEntity), null);

After a lot of trial and error we have concluded that the problem is on entities that have no PK, on tables with PK it works fine. There is no exception, the query just never executes. It worked fine on version 2.5.

Was there a change in versions that would cause this?

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 12-Aug-2017 10:18:41   

Could you check whether these entities are marked as 'readonly' in the designer? On the mappings tab, the 'Allowed Actions' is likely set to Retrieve. This is because allowing 'delete' as an action on an entity without a PK can't work at runtime.

To make this work, you have to specify one field as the PK field, then you can mark the entity deletable otherwise it will give a validation error. In v2.x there was no validation and it allowed this, but in practice this was problematic as you could pass an instance of these entities to the delete method which would never work.

Frans Bouma | Lead developer LLBLGen Pro
gfrankol
User
Posts: 10
Joined: 10-Apr-2017
# Posted on: 14-Aug-2017 12:45:36   

The allowed actions on the problematic tables is indeed "Create / Retrieve" and that seems to be the problem. We will add a PK on these tables and change the allowed actions to include delete. Thanks.