Reputation: 15303
I am trying to start using nhibernate envers and I seem to be getting an error whenever trying to configure it. I'm only trying to setup auditing on a single entity for now to try to keep it somewhat simple. I am getting the following error:
An audited relation from Entities.Product.ProductUoms to a not audited entity Entities.ProductUom!
I setup my auditing like this:
var enversConf = new FluentConfiguration();
enversConf.Audit<Product>();
.ExcludeRelationData("productUoms")
.ExcludeRelationData(x => x.ProductUoms);
// instanceConfiguration.Properties.Add("nhibernate.envers.audit_table_prefix", string.Empty); // default
nhibernateConfiguration.Properties.Add("nhibernate.envers.audit_table_suffix", "_audit"); // default _AUD
nhibernateConfiguration.Properties.Add("nhibernate.envers.revision_field_name", "revision"); // default
nhibernateConfiguration.Properties.Add("nhibernate.envers.revision_type_field_name", "revision_type"); // default
nhibernateConfiguration.IntegrateWithEnvers(metaDataProvider: enversConf);
In my product entity I have the following properties:
private IList<ProductUom> productUoms;
public virtual IEnumerable<ProductUom> ProductUoms { get { return this.productUoms.Select(x => x); } }
They are mapped in Fluent NHibernate like this:
HasMany(x => x.ProductUoms)
.KeyColumn("PROD_ID")
.Inverse()
.Access.CamelCaseField()
.Cascade.AllDeleteOrphan()
.Fetch.Select();
It seems like the error being thrown should be avoided because I'm explicitly trying to exclude the auditing of that relationship. Not quite sure what's going wrong here.
Upvotes: 1
Views: 189