You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call _appService.UpdateAsync()
2. _appService.UpdateAsync do the validation check (using Check.Positive, etc) before calling the _repository.UpdateAsync (no try catch inside)
}
catch (Exception ex) {
//set notification message
notificationmessage = "Fail to update";
}
return RedirectToPage();
The Check.Positive() throw an exception which goes to my catch Exception, set my notificationmessage and redirect to my page. But the database is still being updated instead of rolling back.
How do I make it follow my steps (eg. like if i commented out the _repository.UpdateAsync(), it should not do any update to database) and disable this current behaviour? Thanks.
The text was updated successfully, but these errors were encountered:
In my onPostAsync():
try {
Call _appService.UpdateAsync()
2. _appService.UpdateAsync do the validation check (using Check.Positive, etc) before calling the _repository.UpdateAsync (no try catch inside)
}
catch (Exception ex) {
//set notification message
notificationmessage = "Fail to update";
}
return RedirectToPage();
The Check.Positive() throw an exception which goes to my catch Exception, set my notificationmessage and redirect to my page. But the database is still being updated instead of rolling back.
I read from here: https://abp.io/docs/latest/framework/architecture/domain-driven-design/unit-of-work
if it does not throw exception, it will commit the transaction. But now that it hit my catch Exception and I am trying to return the error with my own notification, it still commit the transaction.
I try commented out the _repository.UpdateAsync() and it still can update the database (?).
I also try to disable the unit of work with this
but it still does not work.
How do I make it follow my steps (eg. like if i commented out the _repository.UpdateAsync(), it should not do any update to database) and disable this current behaviour? Thanks.
The text was updated successfully, but these errors were encountered: