UnitOfWorkBlockTypes

Posts   
 
    
User001
User
Posts: 5
Joined: 19-Nov-2024
# Posted on: 04-Jul-2025 10:19:17   

Let's say I have a Parent Table called X, Child Table called Y. They are link in terms of Primary Key and Foreign Key with a Field called F1.

Want to delete Parent Class but couldnt because I know that there is still a Child Table related to that Parent Table has not deleted.

Do I need to setup own UOW2.CommitOrder? Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 05-Jul-2025 08:37:38   

Yes, so you first set the FK field in Y to NULL, add it to the UOW, add X to the UOW and set the commit order in such a way that updates are run before deletes. If the FK in Y isn't nullable, you have to delete the Y instance, so add that first to the UOW, then X. You can also change the FK constraint in the database to support cascades, e.g. let the DB set the FK to null OR delete the Y instance

Frans Bouma | Lead developer LLBLGen Pro