private static void EnsureCreateDatabaseScriptParameters(Parameters parameters) { if (!string.IsNullOrEmpty(parameters.BuildDatabaseTemplateScript) || !string.IsNullOrEmpty(parameters.BuildDatabaseTemplateName) || (parameters.ProcessMode != Parameters.ProcessType.BuildDatabase && parameters.ProcessMode != Parameters.ProcessType.BuildDatabaseAndCompare && parameters.ProcessMode != Parameters.ProcessType.BuildDatabaseAndCompareAndCreateDelta && parameters.ProcessMode != Parameters.ProcessType.BuildDatabaseAndCompareAndSynchronize)) { return; } string text = parameters.BuildDatabase.Name = (parameters.BuildDatabase.Name ?? Guid.NewGuid().ToString()); string text2 = text.EnsureAbsolutePath(parameters.ArtifactsDirectory); parameters.BuildDatabaseTemplateScript = text2; parameters.CompareSourceDatabase.Name = text; parameters.BuildDatabaseTemplateName = parameters.CompareTargetDatabase.Name; File.WriteAllText(text2, string.Format(new StreamReader(Assembly.GetExecutingAssembly().FindManifestResourceStream("DropAndCreateDatabase.sql")).ReadToEnd(), text)); }
private static Configuration LoadConfiguration(Parameters parameters) { Configuration configuration = new Configuration(parameters.TemplateConfigurationPath); configuration.ProcessTypeString = configuration.ProcessTypeString.Coalesce(parameters.ProcessMode); configuration.RootDirectory = configuration.RootDirectory.CoalesceReverse(parameters.RootDirectory); configuration.ConfigurationPath = configuration.ConfigurationPath.CoalesceReverse(parameters.ConfigurationPath.EnsureAbsolutePath(parameters.ArtifactsDirectory)); configuration.BuildFile = configuration.BuildFile.CoalesceReverse(parameters.BuildScriptPath.EnsureAbsolutePath(parameters.ArtifactsDirectory)); configuration.DeltaFile = configuration.DeltaFile.CoalesceReverse(parameters.CompareDeltaScriptPath.EnsureAbsolutePath(parameters.ArtifactsDirectory)); configuration.ReportPath = configuration.ReportPath.CoalesceReverse(parameters.ReportFilePath.EnsureAbsolutePath(parameters.ArtifactsDirectory)); configuration.BuildTemplateDatabaseName = configuration.BuildTemplateDatabaseName.CoalesceReverse(parameters.BuildDatabaseTemplateName); configuration.BuildTemplateDatabaseScript = configuration.BuildTemplateDatabaseScript.CoalesceReverse(parameters.BuildDatabaseTemplateScript); configuration.BuildDatabaseName = configuration.BuildDatabaseName.CoalesceReverse(parameters.BuildDatabase.Name); configuration.BuildTemplateDatabaseServer = configuration.BuildTemplateDatabaseServer.CoalesceReverse(parameters.BuildDatabase.Server); configuration.BuildTemplateDatabaseUsername = configuration.BuildTemplateDatabaseUsername.CoalesceReverse(parameters.BuildDatabase.Username); configuration.BuildTemplateDatabasePassword = configuration.BuildTemplateDatabasePassword.CoalesceReverse(parameters.BuildDatabase.Password); configuration.BuildTemplateDatabaseAuthenticationMode = configuration.BuildTemplateDatabaseAuthenticationMode.Coalesce(parameters.BuildDatabase.Authentication); configuration.PreserveBuildDatabase = ((parameters.ProcessMode == Parameters.ProcessType.BuildDatabase) ? "true" : configuration.PreserveBuildDatabase.CoalesceReverse(parameters.PreserveBuildDatabase)); configuration.CompareSourceDatabaseName = configuration.CompareSourceDatabaseName.CoalesceReverse(parameters.BuildDatabase.Name); configuration.CompareSourceDatabaseServer = configuration.CompareSourceDatabaseServer.CoalesceReverse(parameters.BuildDatabase.Server); configuration.CompareSourceDatabaseUsername = configuration.CompareSourceDatabaseUsername.CoalesceReverse(parameters.BuildDatabase.Username); configuration.CompareSourceDatabasePassword = configuration.CompareSourceDatabasePassword.CoalesceReverse(parameters.BuildDatabase.Password); configuration.CompareSourceDatabaseAuthenticationMode = configuration.CompareSourceDatabaseAuthenticationMode.Coalesce(parameters.BuildDatabase.Authentication); configuration.CompareSourceDatabaseName = configuration.CompareSourceDatabaseName.CoalesceReverse(parameters.CompareSourceDatabase.Name); configuration.CompareSourceDatabaseServer = configuration.CompareSourceDatabaseServer.CoalesceReverse(parameters.CompareSourceDatabase.Server); configuration.CompareSourceDatabaseUsername = configuration.CompareSourceDatabaseUsername.CoalesceReverse(parameters.CompareSourceDatabase.Username); configuration.CompareSourceDatabasePassword = configuration.CompareSourceDatabasePassword.CoalesceReverse(parameters.CompareSourceDatabase.Password); configuration.CompareSourceDatabaseAuthenticationMode = configuration.CompareSourceDatabaseAuthenticationMode.Coalesce(parameters.CompareSourceDatabase.Authentication); configuration.CompareTargetDatabaseName = configuration.CompareTargetDatabaseName.CoalesceReverse(parameters.CompareTargetDatabase.Name); configuration.CompareTargetDatabaseServer = configuration.CompareTargetDatabaseServer.CoalesceReverse(parameters.CompareTargetDatabase.Server); configuration.CompareTargetDatabaseUsername = configuration.CompareTargetDatabaseUsername.CoalesceReverse(parameters.CompareTargetDatabase.Username); configuration.CompareTargetDatabasePassword = configuration.CompareTargetDatabasePassword.CoalesceReverse(parameters.CompareTargetDatabase.Password); configuration.CompareTargetDatabaseAuthenticationMode = configuration.CompareTargetDatabaseAuthenticationMode.Coalesce(parameters.CompareTargetDatabase.Authentication); configuration.ScriptDatabaseName = configuration.ScriptDatabaseName.CoalesceReverse(parameters.ScriptSourceDatabase.Name); configuration.ScriptDatabaseServer = configuration.ScriptDatabaseServer.CoalesceReverse(parameters.ScriptSourceDatabase.Server); configuration.ScriptDatabaseUsername = configuration.ScriptDatabaseUsername.CoalesceReverse(parameters.ScriptSourceDatabase.Username); configuration.ScriptDatabasePassword = configuration.ScriptDatabasePassword.CoalesceReverse(parameters.ScriptSourceDatabase.Password); return configuration; }
public Application(Parameters parameters) { _parameters = parameters; }
private static Parameters GetChangeManagerParameters(ChangeManager.Options options) { var parameters = new Parameters(); parameters.ApplicationPath = options.ApplicationPath; parameters.ArtifactsDirectory = options.ArtifactsFolder; parameters.BuildDatabaseTemplateName = options.BuildDatabaseTemplateName; parameters.BuildDatabaseTemplateScript = options.BuildDatabaseTemplateScript; parameters.BuildScriptPath = options.BuildFilePath; parameters.CompareDeltaScriptPath = options.DeltaFilePath; parameters.ConfigurationPath = options.ConfigurationPath; parameters.PreserveBuildDatabase = options.PreserveBuildDatabase; parameters.ProcessMode = (Parameters.ProcessType) Enum.Parse(typeof(Parameters.ProcessType), options.ProcessType); parameters.ReportFilePath = options.ReportFilePath; parameters.RootDirectory = options.RootFolder; parameters.TemplateConfigurationPath = options.TemplateConfigurationPath; parameters.XmlReportFilePath = options.XmlReportFilePath; parameters.BuildDatabase = new Parameters.Database { Authentication = options.BuildDatabaseAuthenticationMode != null ? (Parameters.Database.AuthenticationMode) Enum.Parse( typeof ( Parameters.Database.AuthenticationMode), options.BuildDatabaseAuthenticationMode) : Parameters.Database.AuthenticationMode.Windows, Name = options.BuildDatabaseName, Password = options.BuildDatabasePassword, Server = options.BuildDatabaseServer, Username = options.BuildDatabaseUsername }; parameters.CompareSourceDatabase = new Parameters.Database { Authentication = options.CompareSourceDatabaseAuthenticationMode != null ? (Parameters.Database.AuthenticationMode) Enum.Parse( typeof (Parameters.Database.AuthenticationMode), options.CompareSourceDatabaseAuthenticationMode) : Parameters.Database.AuthenticationMode.Windows, Name = options.CompareSourceDatabaseName, Password = options.CompareSourceDatabasePassword, Server = options.CompareSourceDatabaseServer, Username = options.CompareSourceDatabaseUsername }; parameters.CompareTargetDatabase = new Parameters.Database { Authentication = options.CompareTargetDatabaseAuthenticationMode != null ? (Parameters.Database.AuthenticationMode) Enum.Parse( typeof (Parameters.Database.AuthenticationMode), options.CompareTargetDatabaseAuthenticationMode) : Parameters.Database.AuthenticationMode.Windows, Name = options.CompareTargetDatabaseName, Password = options.CompareTargetDatabasePassword, Server = options.CompareTargetDatabaseServer, Username = options.CompareTargetDatabaseUsername }; parameters.ScriptSourceDatabase = new Parameters.Database { Name = options.ScriptSourceDatabaseName, Password = options.ScriptSourceDatabasePassword, Server = options.ScriptSourceDatabaseServer, Username = options.ScriptSourceDatabaseUsername }; return parameters; }
public ConfigurationBuilder(Parameters parameters) { _parameters = parameters; }
private static Configuration LoadConfiguration(Parameters parameters) { var configuration = new Configuration(parameters.TemplateConfigurationPath); configuration.ProcessTypeString = configuration.ProcessTypeString.Coalesce(parameters.ProcessMode); configuration.RootDirectory = configuration.RootDirectory.CoalesceReverse(parameters.RootDirectory); configuration.ConfigurationPath = configuration.ConfigurationPath.CoalesceReverse( parameters.ConfigurationPath.EnsureAbsolutePath( parameters.ArtifactsDirectory)); configuration.BuildFile = configuration.BuildFile.CoalesceReverse( parameters.BuildScriptPath.EnsureAbsolutePath( parameters.ArtifactsDirectory)); configuration.DeltaFile = configuration.DeltaFile.CoalesceReverse( parameters.CompareDeltaScriptPath.EnsureAbsolutePath( parameters.ArtifactsDirectory)); configuration.ReportPath = configuration.ReportPath.CoalesceReverse( parameters.ReportFilePath.EnsureAbsolutePath( parameters.ArtifactsDirectory)); // Template for new database configuration.BuildTemplateDatabaseName = configuration.BuildTemplateDatabaseName.CoalesceReverse(parameters.BuildDatabaseTemplateName); configuration.BuildTemplateDatabaseScript = configuration.BuildTemplateDatabaseScript.CoalesceReverse(parameters.BuildDatabaseTemplateScript); // New database configuration.BuildDatabaseName = configuration.BuildDatabaseName.CoalesceReverse(parameters.BuildDatabase.Name); configuration.BuildTemplateDatabaseServer = configuration.BuildTemplateDatabaseServer.CoalesceReverse(parameters.BuildDatabase.Server); configuration.BuildTemplateDatabaseUsername = configuration.BuildTemplateDatabaseUsername.CoalesceReverse(parameters.BuildDatabase.Username); configuration.BuildTemplateDatabasePassword = configuration.BuildTemplateDatabasePassword.CoalesceReverse(parameters.BuildDatabase.Password); configuration.BuildTemplateDatabaseAuthenticationMode = configuration.BuildTemplateDatabaseAuthenticationMode.Coalesce(parameters.BuildDatabase.Authentication); configuration.PreserveBuildDatabase = parameters.ProcessMode == Parameters.ProcessType.BuildDatabase ? "true" : configuration.PreserveBuildDatabase.CoalesceReverse(parameters.PreserveBuildDatabase); // Default the source to be the same as the build database unless it is specifically overriden configuration.CompareSourceDatabaseName = configuration.CompareSourceDatabaseName.CoalesceReverse(parameters.BuildDatabase.Name); configuration.CompareSourceDatabaseServer = configuration.CompareSourceDatabaseServer.CoalesceReverse(parameters.BuildDatabase.Server); configuration.CompareSourceDatabaseUsername = configuration.CompareSourceDatabaseUsername.CoalesceReverse(parameters.BuildDatabase.Username); configuration.CompareSourceDatabasePassword = configuration.CompareSourceDatabasePassword.CoalesceReverse(parameters.BuildDatabase.Password); configuration.CompareSourceDatabaseAuthenticationMode = configuration.CompareSourceDatabaseAuthenticationMode.Coalesce(parameters.BuildDatabase.Authentication); configuration.CompareSourceDatabaseName = configuration.CompareSourceDatabaseName.CoalesceReverse(parameters.CompareSourceDatabase.Name); configuration.CompareSourceDatabaseServer = configuration.CompareSourceDatabaseServer.CoalesceReverse(parameters.CompareSourceDatabase.Server); configuration.CompareSourceDatabaseUsername = configuration.CompareSourceDatabaseUsername.CoalesceReverse(parameters.CompareSourceDatabase.Username); configuration.CompareSourceDatabasePassword = configuration.CompareSourceDatabasePassword.CoalesceReverse(parameters.CompareSourceDatabase.Password); configuration.CompareSourceDatabaseAuthenticationMode = configuration.CompareSourceDatabaseAuthenticationMode.Coalesce(parameters.CompareSourceDatabase.Authentication); configuration.CompareTargetDatabaseName = configuration.CompareTargetDatabaseName.CoalesceReverse(parameters.CompareTargetDatabase.Name); configuration.CompareTargetDatabaseServer = configuration.CompareTargetDatabaseServer.CoalesceReverse(parameters.CompareTargetDatabase.Server); configuration.CompareTargetDatabaseUsername = configuration.CompareTargetDatabaseUsername.CoalesceReverse(parameters.CompareTargetDatabase.Username); configuration.CompareTargetDatabasePassword = configuration.CompareTargetDatabasePassword.CoalesceReverse(parameters.CompareTargetDatabase.Password); configuration.CompareTargetDatabaseAuthenticationMode = configuration.CompareTargetDatabaseAuthenticationMode.Coalesce(parameters.CompareTargetDatabase.Authentication); configuration.ScriptDatabaseName = configuration.ScriptDatabaseName.CoalesceReverse(parameters.ScriptSourceDatabase.Name); configuration.ScriptDatabaseServer = configuration.ScriptDatabaseServer.CoalesceReverse(parameters.ScriptSourceDatabase.Server); configuration.ScriptDatabaseUsername = configuration.ScriptDatabaseUsername.CoalesceReverse(parameters.ScriptSourceDatabase.Username); configuration.ScriptDatabasePassword = configuration.ScriptDatabasePassword.CoalesceReverse(parameters.ScriptSourceDatabase.Password); return configuration; }