简体   繁体   English

NHibernate Envers-同一类型的多对多关系发生错误

[英]NHibernate Envers - error at many-to-many relationship with the same type

I'm totally new to NHibernate Envers, I have added new field to the entity mapping many-to-many relationship. 我对NHibernate Envers完全陌生,我为映射多对多关系的实体添加了新字段。

public class Product 
{
// initialization in ctor
...
public virtual ISet<FundProduct> ExcludedFromConversion { get; set; }
...
// mapping in ClassMap
            Set(x => x.ExcludedFromConversion, m =>
            {
                m.Table("ExcludedProduct");
                m.Cascade(Cascade.None);
                m.Key(k => k.Column("ProdId"));
            }, map => map.ManyToMany(p => p.Column("ExcludedProdId")))
...
}

and this line in Envers configuration keep throwing an exception: 并且Envers配置中的这一行不断引发异常:

protected virtual void ConfigureEnvers() 
{
...       
configuration.IntegrateWithEnvers(enversConf);
}

Message "Cannot cast 'NHibernate.Mapping.Formula' to 'NHibernate.Mapping.Column'." 消息“无法将'NHibernate.Mapping.Formula'强制转换为'NHibernate.Mapping.Column'。” and top of the stack trace: in " w NHibernate.Envers.Tools.MappingTools.b__0(ISelectable f) in System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() (...) 和堆栈跟踪的顶部:在w w中NHibernate.Envers.Tools.MappingTools.b__0(ISelectable f)在System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()(...)中

I have tried to disable the auditing for this propety by adding [NotAudited] and [Audited(TargetAuditMode = RelationTargetAuditMode.NotAudited)] but it didn't help. 我试图通过添加[NotAudited][Audited(TargetAuditMode = RelationTargetAuditMode.NotAudited)]来禁用此属性的审核,但这没有帮助。

It works without Envers (with the ConfigureEnvers method disabled). 它可以在没有Envers的情况下工作(禁用ConfigureEnvers方法)。

Any help/ideas are appreciated, thanks! 任何帮助/想法表示赞赏,谢谢!

Probably this issue. 可能是这个问题。 It has been fixed in latest envers version (2.0 CR1 - it has just been released). 它已在最新的envers版本(2.0 CR1-刚刚发布)中修复。 What version are you using? 您使用什么版本?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM