UnitOfWork2 IsEmpty returning true when collections to save or delete are present

Posts   
 
    
Dan Suitor
User
Posts: 16
Joined: 07-Feb-2008
# Posted on: 03-Jun-2024 22:51:28   

The UnitOfWork2 IsEmpty property does not appear to be looking to see if there are entities to save in the _collectionsToSave nor _collectionsToDelete collections. As a result, IsEmpty may return true when there are adds/updates/deletes to be performed. Is this a bug, or by design?

Walaa avatar
Walaa
Support Team
Posts: 14968
Joined: 21-Aug-2005
# Posted on: 04-Jun-2024 07:34:41   

Which LLBLGenPro runtime library version are you using?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39689
Joined: 17-Aug-2003
# Posted on: 04-Jun-2024 09:34:03   
public bool IsEmpty =>
    !(_entitiesToDelete.Any() || _entitiesToSave.Any() || _collectionsToDelete.Any() || _callBacksPostDelete.Any() || _callBacksPreDelete.Any() ||
      _callBacksPreInsert.Any() || _callBacksPreUpdate.Any() || _deleteEntitiesDirectlyCalls.Any() || _updateEntitiesDirectlyCalls.Any() ||
      _insertEntitiesDirectlyCalls.Any());

You're right! We'll fix it

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39689
Joined: 17-Aug-2003
# Posted on: 04-Jun-2024 10:04:40   

Fixed in hotfix builds 5.10.4 and 5.11.2

Frans Bouma | Lead developer LLBLGen Pro
Dan Suitor
User
Posts: 16
Joined: 07-Feb-2008
# Posted on: 04-Jun-2024 15:36:17   

We are on 5.10.0.0. We will update to get the fix. Thank you.