0
當我呼叫FindAllByProperty
時,它會在城堡Active Record中調用OnUpdate
,這會導致堆棧溢出,因爲我在OnUpdate
實例上做了一些重複檢查。考慮下面的代碼。爲什麼它叫OnUpdate
?怎麼能阻止它?爲什麼Castle Active Record的FindAllByProperty調用OnUpdate?
protected override void OnUpdate()
{
if (FindAllByProperty("Title", this.Title).Length > 1)
throw new Exception("duplicate Message in update");
base.OnUpdate();
}