Example #1
0
 public void UpgradeStarting(IUpgradeLog upgradeLog)
 {
     if (transactionStrategy != null)
     {
         throw new InvalidOperationException("UpgradeStarting is meant to be called by DbUp and can only be called once");
     }
     transactionStrategy = transactionStrategyFactory[TransactionMode]();
     transactionStrategy.Initialise(upgradeLog);
 }
Example #2
0
        /// <summary>
        /// Tells the connection manager is starting
        /// </summary>
        public IDisposable OperationStarting(IUpgradeLog upgradeLog, List <SqlScript> executedScripts, TransactionMode transactionMode)
        {
            upgradeConnection = CreateConnection(upgradeLog);
            if (upgradeConnection.State == ConnectionState.Closed)
            {
                upgradeConnection.Open();
            }


            transactionStrategy = transactionStrategyFactory[transactionMode]();
            transactionStrategy.Initialise(upgradeConnection, upgradeLog);

            return(new DelegateDisposable(() =>
            {
                transactionStrategy.Dispose();
                upgradeConnection.Dispose();
                transactionStrategy = null;
                upgradeConnection = null;
            }));
        }
Example #3
0
        /// <summary>
        /// Tells the connection manager is starting
        /// </summary>
        public IDisposable OperationStarting(IUpgradeLog upgradeLog, List <SqlScript> executedScripts)
        {
            upgradeConnection = CreateConnection(upgradeLog);
            if (upgradeConnection.State == ConnectionState.Closed)
            {
                upgradeConnection.Open();
            }
            if (transactionStrategy != null)
            {
                throw new InvalidOperationException("OperationStarting is meant to be called by DbUp and can only be called once");
            }
            transactionStrategy = transactionStrategyFactory[TransactionMode]();
            transactionStrategy.Initialise(upgradeConnection, upgradeLog, executedScripts);

            return(new DelegateDisposable(() =>
            {
                transactionStrategy.Dispose();
                upgradeConnection.Dispose();
                transactionStrategy = null;
                upgradeConnection = null;
            }));
        }