Whats the best way for these method calls to use the transaction defined in the outer scope? If one of the method calls fails I want the other changes to be undone.
using var transaction = Db.BeginTransaction();
try
{
await DeleteOrphanedMappingsAsync(sourceDatabaseSchema);
await UpdateChangedMappingsAsync(sourceDatabaseSchema);
await SaveMissingMappingsAsync(sourceDatabaseSchema);
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}