Ok, so our database has many tables that are 'segmented' in that when a field in a row changes, the old row is given an EndDate (previously null) and the row is duplicated with a null EndDate and the new field value. (Every segmented table has a BeginDate that is part of the PK, and an EndDate).
We are wanting to come up with a way to inject custom logic into the save process (adapter pattern) to allow for the segmentation to happen automatically, but so far I've been unable to come up with a way to do it. I need to be able to examine each entity being saved, determine if its a segmented table (probably via a custom property), and if so, check to see if I need to EOL the old row. My first thought was to override SaveEntity(), use ObjectGraphUtils.DetermineActionQueues() to flatten the graph and allow me to traverse all of my entities to be saved, and then deal appropriately with the segmented ones, then call base.SaveEntity(). However, this isn't an option because it doesn't allow for UOW.
OnBeforeEntitySave() won't suffice because it doesn't allow me to inject an entity into the insertion/update chain, plus we are using UOW at times, and I see that UOW now handles persistance entirely on its own so OnBeforeEntitySave() wouldn't even be called.
Frans (or anybody), do you have any suggestions?