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; }
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 ); }
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); }