Custom transaction scope support

The transaction scope could be created by defining an interface, which requires us to either Commit() or Rollback(). The contract required for the custom transaction interface code is shown in the following code:

    public interface ITransactionScope    {      void Commit();      void Rollback();    }

The database transactions were maintained/logged in a transaction list, which is then used to either Commit() or Rollback() for the entire set of transaction objects. In order to use TransactionScope within a using statement, we need to inherit and implement IDisposable as well. The custom TransactionScope implementation which maintains the Commit() and Rollback() is shown in the following code:

 public class TransactionScope ...

Get Mastering Entity Framework Core 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.