使用nhibernate nhsession删除子行
我有顾客和订单使用nhibernate nhsession删除子行,nhibernate,Nhibernate,我有顾客和订单 Customers --------- CustomerId | OrderId 1 | 1 2 | 2 Orders ------- OrderId | Amount 1 | 24 2 | 25 我想从NhSession中删除子订单。 现在我正在做 NhSession.Delete(orders)给了我一个错误。 删除的对象将通过级联重新保存(从关联中删除删
Customers
---------
CustomerId | OrderId
1 | 1
2 | 2
Orders
-------
OrderId | Amount
1 | 24
2 | 25
我想从NhSession中删除子订单。
现在我正在做
NhSession.Delete(orders)给了我一个错误。
删除的对象将通过级联重新保存(从关联中删除删除的对象)
为了删除子项,我做了一些映射更改吗?在代码中重置关联,这总是比没有损坏的模型更好
NhSession.Delete(customer.Order);
customer.Order = null;
NhSession.Flush();