public Task Commit(IDbContextTransaction transaction) { if (transaction == null) { throw new TransactionNullException("Transaction cannot be null to perform transaction operations."); } var transactionSavePointName = DateTime.UtcNow.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture); return(Task.Run(async() => { try { transaction.CreateSavepoint(transactionSavePointName); _ = await SaveChanges().ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); } catch (DbUpdateConcurrencyException ex) { Devon4NetLogger.Error(ex); RollbackTransaction(transaction, transactionSavePointName); throw; } catch (Exception ex) { Devon4NetLogger.Error(ex); RollbackTransaction(transaction, transactionSavePointName); throw; } })); }