How is the DeleteStatus in associated tables updated when DeleteStatus is true in a table?

26 Views Asked by At

if I need to briefly illustrate my issue, let's assume I have a table and imagine that I've changed the DeleteStatus column in a row of this table to true. In this case, this row will be treated as deleted. However, other tables associated with this table should detect this change and switch to a true state. How can I achieve this? Below, I will share the function I use for deletion.

   public int Delete(T obj)
    {
        if (obj is BaseEntity)
        {
            BaseEntity o = obj as BaseEntity;
            o.DeleteStatus = true;
        }
        //_objectSet.Remove(obj);
        return Save();
    }
1

There are 1 best solutions below

1
Edmunds On

Do you use any DB? If yes you can create a trigger to catch update, and set all other values as you want