Hi I'm using Session per Request pattern. Transactions are managed automatically.
How can I easily handle StaleObjectStateException and show some specific view?
Hi I'm using Session per Request pattern. Transactions are managed automatically.
How can I easily handle StaleObjectStateException and show some specific view?
You might want to override OnException in your controller and if a StateObjectStateException occurs, you could set the Result on the ExceptionContext to your error view result.
public override void OnException( ExceptionContext context )
{
if (context.Exception is StateObjectStateException)
{
context.Result = View("error");
context.ExceptionHandled = true;
}
}
Aside: You might also want to start accepting answers to your questions. A 0% acceptance rate isn't going to go over well with some people, who might choose not to answer your questions.