NHibernate 审计拦截器 - 审计集合时当前值和以前的值匹配
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,还有其他与集合相关的事件需要重写。
Turns out there's other events to override concerned specifically with collections.