Search code examples
transactionsasp.net-core-2.0

How to make a transaction in asp.net-core 2.0?


I want to update some values but in case one fails I need to rollback. How can I do this in asp.net-core-2.0?

I have not found any answers yet. Is this because it is not yet supported? In that case what are some alternatives?


Solution

  • Yes man, using System.Transactions.TransactionScope, available since .Net Core 2.0 and above. check this:

    Using System.Transactions in ASP.NET: https://msdn.microsoft.com/en-us/ms229977

    Implementing an Implicit Transaction using Transaction Scope: https://msdn.microsoft.com/en-us/ms172152