Ejemplo n.º 1
0
 public void SaveToConfig(DbMigrationsConfigurationSection config)
 {
     config.InvariantName = InvariantName;
     config.TableName = TableName;
     config.Schema = Schema;
     config.EscapeChar = EscapeCharacter;
     config.CountMigrationTables.Sql = CountMigrationTablesStatement;
     config.DropAllObjects.Sql = DropAllObjectsStatement;
     config.ConfigureTransaction.Sql = ConfigureTransactionStatement;
     config.CreateMigrationTable.Sql = CreateTableTemplate;
 }
Ejemplo n.º 2
0
        private static DbQueries FromConfigurationSection(DbMigrationsConfigurationSection config)
        {
            if (string.IsNullOrEmpty(config?.InvariantName))
                return null;

            return new DbQueries(
                config.InvariantName,
                config.EscapeChar,
                config.TableName,
                config.Schema,
                config.ConfigureTransaction?.Sql ?? string.Empty,
                config.CreateMigrationTable?.Sql ?? string.Empty,
                config.CountMigrationTables?.Sql ?? string.Empty,
                config.DropAllObjects?.Sql ?? string.Empty
                );
        }
Ejemplo n.º 3
0
 private static void SaveConfiguration(DbQueries dbQueries)
 {
     var c = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     var m = (DbMigrationsConfigurationSection) c.GetSection("migrationConfig");
     if (m == null)
     {
         m = new DbMigrationsConfigurationSection();
         c.Sections.Add("migrationConfig", m);
     }
     dbQueries.SaveToConfig(m);
     c.Save(ConfigurationSaveMode.Minimal);
 }