I have tried to make ENVERS (Audit and Logging Tool for NHibernate) work with the ValidityAuditStrategy strategy, but I have'nt been successfull.
My NHibernate (fluent using envers extension method) looks like this:
var fluentConfiguration = Fluently.Configure()
.Database(msSqlConfiguration)
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<MetaObject>())
.Mappings(m =>
m.FluentMappings.Conventions.AddFromAssemblyOf<MetaObject>())
.ExposeConfiguration(cfg =>
{
cfg.EventListeners.PreInsertEventListeners =
new IPreInsertEventListener[] { new SimpleAuditEventListener() };
cfg.EventListeners.PreUpdateEventListeners =
new IPreUpdateEventListener[] { new SimpleAuditEventListener() };
// ENVERS
cfg.IntegrateWithEnvers(GetEnversConfiguration()); // this is ok
// ENVERS Strategy
//cfg.SetProperty("nhibernate.envers.audit_strategy ", typeof(ValidityAuditStrategy).AssemblyQualifiedName); // does not work :-(
cfg.SetProperty("nhibernate.envers.audit_strategy ", "NHibernate.Envers.Strategy.ValidityAuditStrategy"); // does not work :-(
cfg.SetEnversProperty(ConfigurationKey.AuditStrategy, typeof(ValidityAuditStrategy)); // does not work :-(
}
).ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(false, true));
I have different ways to configure the audit strategy, but the default strategy is always used. When using validity strategy, the created audit tables should have an additional columns "REVEND". However, this is not the case and I am a bit at loss at what I should try next.
Is my configuration wrong? Or is it not possible to have the sql tables created by NHibernate (I do this with the last line of the configuration).
Any help is appreciated. Thanks