i am using envers attribute configuration and instead of using fluentconfiguration it is useful attribute configuration for this case. i am on mobile now but when i am on pc i can send a sample code 10 Nis 2013 20:14 tarihinde <[email protected]> yazdı:
> > In integrating NHibernate.Envers with our framework, I'm trying to > determine how to enable auditing on one table but not on a related table. > We're using FluentConfiguration, out of a desire to be as POCO as possible. > > I have three classes: AuditParent, AuditChild, and NoAuditChild, where > there's a one-to-many from AuditParent to both other classes. My Envers > configuration looks like this: > > var ecfg = new FluentConfiguration(); > ecfg.Audit<AuditParent>() > .ExcludeRelationData(a => a.NoAuditChildren); > ecfg.Audit<AuditChild>(); > > When I run cfg.IntegrateWithEnvers(ecfg), though, I get the following > error: > > NHibernate.MappingException : An audited relation from > NHibernate.Envers.Tests.NetSpecific.UnitTests.CustomLists.AuditParent.NoAuditChildren > to a not audited entity > NHibernate.Envers.Tests.NetSpecific.UnitTests.CustomLists.NoAuditChild! > at > NHibernate.Envers.Configuration.Metadata.AuditMetadataGenerator.GetReferencedIdMappingData(String > entityName, String referencedEntityName, PropertyAuditingData > propertyAuditingData, Boolean allowNotAuditedTarget) > in AuditMetadataGenerator.cs: line 546 > at > NHibernate.Envers.Configuration.Metadata.CollectionMetadataGenerator.addOneToManyAttached(Boolean > fakeOneToManyBidirectional) > in CollectionMetadataGenerator.cs: line 116 > at > NHibernate.Envers.Configuration.Metadata.CollectionMetadataGenerator.AddCollection() > in CollectionMetadataGenerator.cs: line 94 > ... > > It looks to me like the code is adding AuditedAttribute(TargetAuditMode = > RelationTargetAuditMode.NotAudited) to the property, but somehow this > doesn't stop the mapping code from trying to map the relation anyway. > There may be a problem with the if condition in > GetReferencedIdMappingData... I should be able to upload a failing unit > test on Bitbucket if desired, unless I'm just doing something wrong with my > configuration. > > Aaron V. Humphrey > Pleasant Solutions > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/nhusers?hl=en-US. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
