I am looking for a central action solution for tph tables

56 Views Asked by At

Net core project, I'm writing a ticket management service.

I applied the TPH(Table Per Hierarchy) method in the database. I created a table called TicketGeneral as a main table. The names of the sub-entities are as follows: TicketMobileType TicketRequestType.

I also have history (log) tables with exactly the same table structure. I also created a History table using TPH. The name of the relevant main table is TicketGeneralHistory and its sub-entities are: TicketMobileTypeHistory and TicketRequestTypeHistory.

For each CRUD operation to be performed within the main tables, I want to record the History table with the action column. (its a string column for ["Insert","DELETE","UPDATE"]) Can I do this by setting up a single central structure instead of writing repetitive code for each entity separately?

Notes: I can't use a trigger via database for this scenario

0

There are 0 best solutions below