If I set dynamic-update=true I've found that fields updated in my Interceptor do not get included in the update statement that goes to the database. When I set it to false all the columns including the time stamp get updated. I really want to use dynamic update.
public class Interceptor : EmptyInterceptor
{
public override Boolean OnFlushDirty(object entity, object id, object[] state,
object[] previousState, string[] propertyNames, IType[] types)
{
var auditEntity = entity as BaseAuditEntity;
if (auditEntity != null)
{
var now = DateTime.Now;
var index = Array.IndexOf(propertyNames, "LastModifiedTimestamp");
state[index] = now;
auditEntity.LastModifiedTimestamp = now;
}
return base.OnFlushDirty(entity, id, state, previousState, propertyNames, types);
}
}
I thought that this line would have marked my the last modified column as dirty.
auditEntity.LastModifiedTimestamp = now;
Is there something I should do in my interceptor to mark the time stamp field as dirty?