I have three mappings as follows:
public MainChapterMap()
{
// other properties
HasMany(x => x.ClientSpecific).KeyColumn("MainChapterId");
}
public MainChapterClientMap()
{
// other properties
References(x => x.MainChapter).Column("MainChapterId");
HasMany(x => x.Details).KeyColumn("MainChapterClientId");
}
public MainChapterClientDetailMap()
{
// other properties
References(x => x.MainChapterClient).Column("MainChapterClientId");
}
MainChapter has many client-specific chapters. The client-specific chapters (MainChapterClient) has many translations (MainChapterClientDetail)
The dele rules should be as follow:
- When deleting a
MainChapter- Delete the
MainChapterClientrow - Delete the
MainChapter开发者_开发问答ClientDetailrow(s)
- Delete the
- When deleting a
MainChapterClient- Do NOT delete the
MainChapterrow - Delete the
MainChapterClientDetailrow(s)
- Do NOT delete the
- When deleting a
MainChapterClientDetail- Do NOT delete the
MainChapterrow - Do NOT delete the
MainChapterClientDetailrow(s)
- Do NOT delete the
But I no matter what I end up getting this error:
deleted object would be re-saved by cascade (remove deleted object from associations)[Entities.MainChapterClient#39]
I'm not sure how to set up my cascades anymore. Any help are more than welcomed!
You need to remove the reference from both sides :
MainChapterClient.Details.Remove(instance);
instance.MainChapterClient = null;
加载中,请稍侯......
精彩评论