Beispiel #1
0
        void IMigration <SQLiteConnection> .RunMigration(MigrationRunData <SQLiteConnection> data)
        {
            Connection = data.Connection;
            Logger     = data.Logger;

            if (UseTransaction)
            {
                using (var transaction = Connection.BeginTransactionSafe())
                {
                    try
                    {
                        ApplyMigration(data.Direction);
                        transaction.Commit();
                    }
                    catch
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
            else
            {
                ApplyMigration(data.Direction);
            }
        }
Beispiel #2
0
        void IMigration <IDbConnection> .RunMigration(MigrationRunData <IDbConnection> data)
        {
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromMinutes(10)))
            {
                Connection = data.Connection;
                Logger     = data.Logger;

                if (data.Direction == MigrationDirection.Up)
                {
                    Up();
                    Down();
                    Up();
                }
                else
                {
                    Down();
                }

                scope.Complete();
            }
        }
Beispiel #3
0
        void IMigration <SQLiteConnection> .RunMigration(MigrationRunData <SQLiteConnection> data)
        {
            this.Connection = data.Connection;
            this.Logger     = data.Logger;

            if (this.UseTransaction)
            {
                try
                {
                    this.Connection.BeginTransaction();

                    if (data.Direction == MigrationDirection.Up)
                    {
                        this.Up();
                    }
                    else
                    {
                        this.Down();
                    }

                    this.Connection.Commit();
                }
                catch
                {
                    this.Connection.Rollback();
                    throw;
                }
            }
            else
            {
                if (data.Direction == MigrationDirection.Up)
                {
                    this.Up();
                }
                else
                {
                    this.Down();
                }
            }
        }
Beispiel #4
0
 public void RunMigration(MigrationRunData <IDbConnection> data)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
        public void RunMigration(MigrationRunData <MartenConnection> data)
        {
            Session = data.Connection.Session;

            Up().GetAwaiter().GetResult();
        }