DEV Community

Discussion on: Transaction middleware in ASP.NET Core

Collapse
akashkava profile image
Akash Kava

Disposing transaction will rollback it anyway, so no need for this block
catch (Exception)
{
transaction?.Rollback();

throw;
Enter fullscreen mode Exit fullscreen mode

}

Collapse
moesmp profile image
Mohsen Esmailpour Author

Good catch, thanks.

Collapse
alexandis profile image
alexandis

Could you please adjust your code accordingly?

Thread Thread
moesmp profile image
Mohsen Esmailpour Author

Sure