A default/generic predicate for an IsActive column

Posts   
 
    
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 16-Mar-2022 16:57:11   

I'm looking for a way, before the query gets generated using the Adapter template with .NET Standard 2.1, to check if any of the Entities/Tables included in the query, has an "IsActive" field and add a predicate for IsActive = 1. If there is an IsActive = 0 already, I would like to add IsActive = 1 with an 'OR' (for the admin screens of the app to see both Active/Inactive records).

The posts above mentioned soft deletes. That really isn't the purpose of the IsActive flag. We activate/inactivate certain entities regularly. We delete records from our table, using Temporal Tables in Azure SQL Server.

I've used LLBLGen since 2005, and have advocated it for every job I've had since then. Now I'm in an architect role, and code a lot less than I used to, and I've recently brought on a team of about 12 java developers, converted them to .NET and introduced them to LLBLGen. These guys are learning a lot and seem to be embracing LLBLGen, but this was one 'ask' that I had no idea if it could be done. When they told me that they had this feature in whatever framework they were using on their java projects, I wanted to make sure I exhausted every effort to make their lives easier. See below for the links that I found already (with no luck getting it to work)...


I searched the forum and the closest thing I could find was this article that seemed to explain the same situation: https://www.llblgen.com/tinyforum/Thread/13514 However, the link for a solution is broken. It looks like you've updated the forum and some of the old posted links are dead now.

Also, this thread gave me a little hope, https://www.llblgen.com/tinyforum/Thread/15311/1 but the code did not translate to what is in the CreateSelectDQ method in the adapter (I'm currently at version 5.8.3 designer, but I think it is using the 5.7 framework?? I'm not sure how to tell, but my project references SD.LLBLGen... (5.7.0)).

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 17-Mar-2022 04:14:35   

Please check this message: https://llblgen.com/TinyForum/Thread/22178#128876

I think you should start from there, by overriding FetchEntityCollection.

As for the admin view, just use the DataAccessAdapter class and not your derived class, and thus fetching all records without using the default filter.

usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 17-Mar-2022 18:27:03   

Thanks, this looks promising.