Esempio n. 1
0
 public void FinishTransaction(IDataAccessAdapter adapter)
 {
     if (adapter.IsTransactionInProgress)
     {
         adapter.Rollback();
     }
 }
        /// <summary>
        /// Invoke on Scope with Transaction.
        /// </summary>
        protected void InvokeWithTransactionOnScope(string transactionName, Action <DataScope <TSession, TMetaData> > toPerform)
        {
            using (IDataAccessAdapter adapter = _AdapterService.CreateAdapter())
            {
                try
                {
                    _AdapterService.StartTransaction(adapter, transactionName);

                    var scope = BuildDataScope(adapter);

                    PerformActionsOnScope(_AdapterService, toPerform, scope);

                    _AdapterService.FinishTransaction(adapter);
                }
                catch (Exception ex)
                {
                    adapter.Rollback();
                    if (!HandleException(transactionName, ex))
                    {
                        throw ex;
                    }
                }
                finally
                {
                    adapter.Dispose();
                }
            }
        }
 public void FinishTransaction(IDataAccessAdapter adapter)
 {
     if (adapter.IsTransactionInProgress)
         adapter.Rollback();
 }