且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

流利的NHibernate一对一没有级联所有删除的孤儿

更新时间:2022-06-24 08:04:41

最后,无论默认的流畅行为如何,我都只需要找出问题所在并加以解决.借助 http://brunoreis. com/tech/fluent-nhibernate-hasone-how-implementation一对一关系/我能够解决此问题.

In the end, I just needed to figure out what was wrong and fix this, regardless of the default fluent behavior. With the help of http://brunoreis.com/tech/fluent-nhibernate-hasone-how-implement-one-to-one-relationship/ I was able to solve this issue.

我需要添加.Cascade.All().但是,我真正需要的是LineItemAssembly类映射中的HasOne关系中的.ForeignKey().

I needed to add .Cascade.All(). However, what I really needed was a .ForeignKey() off the HasOne relationship in my mapping for the LineItemAssembly class.