当我在城堡 Active Record 中调用FindAllByProperty它OnUpdate时,这会导致堆栈溢出,因为我对OnUpdate实例进行了一些重复检查。考虑以下代码。为什么它调用OnUpdate?怎么能阻止呢?
protected override void OnUpdate()
{
if (FindAllByProperty("Title", this.Title).Length > 1)
throw new Exception("duplicate Message in update");
base.OnUpdate();
}