Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我从集合(例如列表)中删除某个对象(或删除它)并从该集合的父级调用 SaveOrUpdate 时,子行不会被删除,而是通过将外键值设置为 NULL 来更新。
我怎样才能强制它被删除(子行)。
您需要将集合标记为关系的反面,并将级联设置设置为 all-delete-orphan。NHibernate 正在尝试将外键更新为 null,因为您通过从集合中删除它创建了一个孤儿,但没有指示它删除孤儿。