private static string ResolveConflictByUnsedName([NotNull] SqlConnectionStringBuilder defaultConnectionString, [NotNull] Adapters.WebServer.ConnectionString connectionString, [NotNull] string databaseName)
        {
            Assert.ArgumentNotNull(defaultConnectionString, nameof(defaultConnectionString));
            Assert.ArgumentNotNull(connectionString, nameof(connectionString));
            Assert.ArgumentNotNull(databaseName, nameof(databaseName));

            databaseName = GetUnusedDatabaseName(defaultConnectionString, databaseName);
            connectionString.RealName = databaseName;
            connectionString.SaveChanges();
            return(databaseName);
        }
        public static void AttachDatabase(Adapters.WebServer.ConnectionString connectionString, SqlConnectionStringBuilder defaultConnectionString, string name, string sqlPrefix, bool attachSql, string databasesFolderPath, string instanceName, IPipelineController controller)
        {
            if (connectionString.IsMongoConnectionString)
            {
                connectionString.Value = GetMongoConnectionString(connectionString.Name, sqlPrefix);
                connectionString.SaveChanges();
                return;
            }

            if (connectionString.IsSqlConnectionString)
            {
                AttachDatabase(name, sqlPrefix, attachSql, databasesFolderPath, connectionString, defaultConnectionString, controller);
            }
        }
        private static void SetConnectionStringNode([NotNull] string name, [NotNull] string sqlPrefix, [NotNull] SqlConnectionStringBuilder defaultConnectionString, [NotNull] Adapters.WebServer.ConnectionString connectionString)
        {
            Assert.ArgumentNotNull(name, nameof(name));
            Assert.ArgumentNotNull(sqlPrefix, nameof(sqlPrefix));
            Assert.ArgumentNotNull(defaultConnectionString, nameof(defaultConnectionString));
            Assert.ArgumentNotNull(connectionString, nameof(connectionString));

            SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(defaultConnectionString.ConnectionString)
            {
                InitialCatalog     = connectionString.GenerateDatabaseName(name, sqlPrefix),
                IntegratedSecurity = false
            };

            connectionString.Value = builder.ToString();
            connectionString.SaveChanges();
        }