示例#1
0
        public async Task <bool> Commit()
        {
            try
            {
                if (transaction != null)
                {
                    await transaction.CommitAsync();
                }

                return(true);
            }
            catch
            {
                if (transaction != null && transaction.IsActive)
                {
                    await transaction.RollbackAsync();
                }

                return(false);
            }
            finally
            {
                transaction.Dispose();
                transaction = null;
            }
        }