Let's take a look at our solution.
The FlaggedForDelete
concept is not one I am going to spend too much time on. You simply need to add FlaggedForDelete
columns to each of your tables with false
as the default value. As we are using LINQ to SQL, you would then need to update all the tables in your LINQ to SQL design surface. Then specify the default value of the FlaggedForDelete
field as false
in all your INSERT
statements (you will need to set this value as objects come in to be inserted). With this in place, you would next need to update all your SELECT statements to check against the FlaggedForDelete
field excluding items that are marked true
. Don't forget that when you are running joined queries to check the FlaggedForDelete
field on the linked tables as well. Last, you need to have a scheduled process that grabs all the rows that are flagged for deletion and removes them.
The process for removing rows that are flagged for delete is this:
From table A, select...