我们正在使用Umbraco和uCommerce构建B2B门户
在nHibernate实体删除问题上背对着墙。每当我尝试从uCommerce后台UI中删除产品SKU(您还有3个变体SKU)时,我们会得到以下异常。正如异常所建议的那样,尝试删除其他实体映射类中的所有关联,但没有运气。
有趣的是,如果我不在nHibernate会话对象上使用事务scope(_session.BeginTransaction())
,则删除完全没有异常。
所以我的问题/混淆真的是nHibernate在使用事务范围时会有什么不同导致这种异常吗?
Exception Details: NHibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)[UCommerce.EntitiesV2.Product#105]
Stack Trace:
[ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)[UCommerce.EntitiesV2.Product#105]]
NHibernate.Impl.SessionImpl.ForceFlush(EntityEntry entityEntry) +653
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) +296
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event) +413
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) +845
NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event) +327
NHibernate.Impl.SessionImpl.SaveOrUpdate(String entityName, Object obj) +223
NHibernate.Engine.SaveUpdateCascadingAction.Cascade(IEventSource session, Object child, String entityName, Object anything, Boolean isCascadeDeleteEnabled) +257