NHibernate 审计拦截器 - 审计集合时当前值和以前的值匹配

发布于 2024-09-15 14:57:26 字数 1120 浏览 4 评论 0原文

我正在使用 NHibernate Audit Inteceptor 审核某些值 - 我从 EmptyInteceptor 继承并重写了 OnFlushDirty

public override bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types)
    {

对于大多数情况, currentState 和 previousState 对象是我所期望的 - 但我已经映射了一个集合并且不起作用 -先前和当前都显示相同的收藏值。

有人可以帮忙吗?

这是我正在使用的映射...

    public SalesChannelMap()
    {
        Id(x => x.ID).GeneratedBy.Custom<StringTableHiLoGenerator>(a => a.AddParam(NHibernateConstants.MaxLo, Nexus3General.HiLoGeneratorMaxLoSize.ToString()));
        Version(x => x.Version);
        Map(x => x.Name).Unique();
        Map(x => x.Exclusive);
        Map(x => x.Active);
        Map(x => x.Visible);
        Map(x => x.VehicleType);
        Map(x => x.PriceAdjustment);
        Map(x => x.Deleted);
        Map(x => x.FactoryFlag);
        Map(x => x.Initials);
        HasMany(x => x.VehicleIDs).AsBag().Element("VehicleID", m => m.Type<string>()).Table("SalesChannelVehicleLinker"); 
    }

I'm auditing certain values using a NHibernate Audit Inteceptor - I have inherited from the EmptyInteceptor and overridden the OnFlushDirty

public override bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types)
    {

For the most part the currentState and previousState objects are what I'd expect - but I've mapped a collection and dosnt work - the previous and current both show the same collection values.

Can anyone assist please?

Heres the mapping I'm using ...

    public SalesChannelMap()
    {
        Id(x => x.ID).GeneratedBy.Custom<StringTableHiLoGenerator>(a => a.AddParam(NHibernateConstants.MaxLo, Nexus3General.HiLoGeneratorMaxLoSize.ToString()));
        Version(x => x.Version);
        Map(x => x.Name).Unique();
        Map(x => x.Exclusive);
        Map(x => x.Active);
        Map(x => x.Visible);
        Map(x => x.VehicleType);
        Map(x => x.PriceAdjustment);
        Map(x => x.Deleted);
        Map(x => x.FactoryFlag);
        Map(x => x.Initials);
        HasMany(x => x.VehicleIDs).AsBag().Element("VehicleID", m => m.Type<string>()).Table("SalesChannelVehicleLinker"); 
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白云不回头 2024-09-22 14:57:26

事实证明,还有其他与集合相关的事件需要重写。

Turns out there's other events to override concerned specifically with collections.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文