riteshrao/ncommon

UnitOfWorkAttribute won't rollback if an exception occurs and UnitOfWorkSettings.AutoCompleteScope is true

jimitndiaye opened this issue · 3 comments

UnitOfWorkAttribute uses Dispose on the UnitOfWorkScope to rollback when an exception occurs but the implementation of that will commit regardless if UnitOfWorkSettings.AutoCompleteScope is true.

Not sure I understand what the issue is here... Regardless if you set the AutoCompleteScope to true or not, the filter will always call Commit() in OnActionExecuted or in OnResultExecuted, so if there is an exception during the commit phase that will cause a rollback. Do you have a test case that I can review to see what the underlying issue is?

The problem isn't what would happen if Commit is called. The problem
is that when you explicitly try to initiate a rollback
(filterContext.Exception != null) you call Dispose. Commit is never
called in that scenario (and it shouldn't).
However, the current implementation of Dispose on UnitOfWorkScope will
then try to commit anyway if AutocompleteScope is true which is not
what you want.

Sent from my iPhone

On 25 Oct 2011, at 05:16, Ritesh Rao
reply@reply.github.com
wrote:

Not sure I understand what the issue is here... Regardless if you set the AutoCompleteScope to true or not, the filter will always call Commit() in OnActionExecuted or in OnResultExecuted, so if there is an exception during the commit phase that will cause a rollback. Do you have a test case that I can review to see what the underlying issue is?

Reply to this email directly or view it on GitHub:
#29 (comment)

Any update of this issue?