When I call FindAllByProperty
it calls OnUpdate
in castle Active Record, This causes an stack overflow because I do some duplicating check on OnUpdate
an instance. Consider following code. Why it calls OnUpdate
? How can stop it?
protected override void OnUpdate()
{
if (FindAllByProperty("Title", this.Title).Length > 1)
throw new Exception("duplicate Message in update");
base.OnUpdate();
}
Here's what's probably happening:
Thus, a stack overflow.
To avoid this, try running FindAllByProperty() within a new session:
using (new SessionScope())
if (FindAllByProperty("Title", this.Title).Length > 1)
throw new Exception("duplicate Message in update");