Design question regarding business object delete with child table deletes and history actions #4011
-
Hello all, I have a question regarding how you would go about a specific process. For simplicity’s sake I have a business object that when its marked for deleted there are 6 actions that need to done with it. I need to copy three entities to a history table and after that I need to delete the items data from the tables. How would you go about it? As of now I’m adding the code in the parent business object Delete method to perform all the actions. I really don’t like it because I’m injecting all sorts of objects to accomplish the task and creating helper methods to perform the actions within the parent business object. I was wondering if a Unit of work/Command would be best. This way I can mark the business object as Delete and then inject one command which will run Delete process and have the bulk code. This will keep my business parent object clean. What do you guys think? @Chicagoan2016 similar to what you just asked. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Im trying to do the actions in a command but I notice that my following is not working "BypassPropertyChecks" and adding child broken rules to the parent object. when coping for history table insert.
and the following might be an issue
|
Beta Was this translation helpful? Give feedback.
-
If im getting the errors with the command object then maybe a business object that takes care of the delete process? |
Beta Was this translation helpful? Give feedback.
-
I ended up creating delete triggers, on my tables, that copy the data to history tables. We have scenarios where we delete objects (and their children) and insert new objects (their data) in the database. |
Beta Was this translation helpful? Give feedback.
I ended up creating delete triggers, on my tables, that copy the data to history tables. We have scenarios where we delete objects (and their children) and insert new objects (their data) in the database.
All of our objects have delete methods that in turn call delete methods in dataaccess layer (we use encapsulated invocation).
In the dataportal create methods we call the delete methods on data access first ( and eventually delete stored procs) and then we call the Insert methods in data access layer (within the aforementioned dataportal create).
I hope I didn't make it sound too confusing : )