コード例 #1
0
        private void RunBeforeMigration(IMigration migration, DatabaseVersionModel databaseVersion)
        {
            // Check Actual DatabaseVersion against the migration version
            // Don't run unless this Migrations BeforeMigration has not been run
            if (databaseVersion.IsBeforeMigrationComplete == false)
            {
                migration.DbProvider = _dbProvider;

                // Before Migrate
                migration.BeforeMigrate();
                if (_systemRole == SystemRole.Server)
                {
                    migration.ServerBeforeMigrate();
                }
                if (_systemRole == SystemRole.Client)
                {
                    migration.ClientBeforeMigrate();
                }

                // Update the database version to show the before migration has been run
                databaseVersion.IsBeforeMigrationComplete = true;
                _dbProvider.Query <DatabaseVersionModel>().Where(dbv => dbv.VersionNumber == migration.MigrationVersion).Update(databaseVersion);
            }
        }