0
我在从A到B的数据模型中拥有一对多的关系。但是在我的域API中,我没有在A上公开“B”(因为我们永远不会从A到B导航) ,但是从B到A有一个参考。现在我想删除A时删除所有“B”。可能吗?现在NH正在尝试首先将FK设置为null,这是我不想要的,因为列不能为空。NHibernate级联删除
A = SupplierType
B = BaseProductCoInsurance
public BaseProductCoInsuranceMap()
{
Table("BaseProductCoInsurance");
Id(x => x.Id, "BaseProductCoInsuranceId");
Map(x => x.CoInsurancePercent).Column("CoInsrPrcnt");
References(x => x.BaseProduct, "BaseProductId");
References(x => x.PolicySupplierType, "PlcySupplierTypeID");
References(x => x.InsuredType, "InsuredTypeCode");
}
你的贴图是什么样的? – R0MANARMY 2010-06-24 15:27:10
我会“设置cascade =全部删除孤儿”,你有没有试过? – VoodooChild 2010-06-24 15:32:30
@ROMANARMY:我刚刚用映射更新了这个问题 – epitka 2010-06-24 15:50:03