PetaPoco
PetaPoco copied to clipboard
Extra data for table/column metadata
I'm using an altered version of PetaPoco that includes database operations in a history table (TableName, Date and a JSON with the current poco version).
For this, I've created a new attribute called DontKeepHistoryAttribute that will turn off this behavior for some tables.
It would be nice if, in database.tt, we could set some extra parameters as a dictionary, i.e.:
tables["Security.Audits"]["ExtraData"]["DontKeepHistory"] = true;
and maybe an OnBeforeExecuteCommand and OnAfterExecuteCommand as partial methods where we could check this "DontKeepHistory" flag to do some action.
Hi,
I wat to add a comment on this.
For tracking user changes we are using a common interface with creation and modify user / date. It will be really useful to have a funcion hook where to assign the current user and date.
In our repository implementation we have two events "OnBeforeCommit" and "OnAfterCommit" that receives in input a flat list of persisted entities.
At this point it will be easy to check for an interface implementation and do something.
Thanks, Enrico