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