The @event.LoadedState
contains the previous values in an array, @event.PropertyValues
contains the current values. The corresponding persister.PropertyNames
contains the property names in the same order and persister.PropertyTypes
the NH types.
Example:
for (int i = 0; i < @event.PropertyValues.Length; i++)
{
Console.WriteLine("Property {0} : {1} => {2}",
@event.EntityEntry.Persister.PropertyNames[i],
@event.LoadedState[i],
@event.PropertyValues[i]);
}
I'm not sure if the "LoadedState" is actually the state that had been loaded. It might be the state in the DB, which may change with every flush. Check this. It may be necessary to take the "first loaded state" you get from the event.
Note: I wrote an "automatic audit trail writer". With complex entities it gets very complicated. Most complicated is the nesting of objects (parent - child). The event is in the depths of NH. You need to handle components and collections.