public FakeInstance(string webRootPath, string dataFolderPath, Database[] databases) : base(0) { this.webRootPath = webRootPath; this.dataFolderPath = dataFolderPath; this.getAttachedDatabases = databases; }
public static void AddDatabases([NotNull] XmlElement connectionStringsNode, [NotNull] List<Database> databases) { Assert.ArgumentNotNull(connectionStringsNode, "connectionStringsNode"); Assert.ArgumentNotNull(databases, "databases"); using (new ProfileSection("Add databases to web.config", typeof(WebConfig))) { ProfileSection.Argument("connectionStringsNode", connectionStringsNode); ProfileSection.Argument("databases", databases); XmlNodeList nodes = connectionStringsNode.SelectNodes("add"); if (nodes != null && nodes.Count > 0) { var elements = nodes.OfType<XmlElement>().ToArray(); Log.Debug("WebConfig:AddDatabases(...)#elements.Length: " + elements.Length); foreach (XmlElement node in elements) { string name; string value = node.GetAttribute("connectionString"); Log.Debug("WebConfig:AddDatabases(...)#value: " + value); if (!SqlServerManager.Instance.IsSqlConnectionString(value)) { continue; } name = node.GetAttribute("name"); Log.Debug("WebConfig:AddDatabases(...)#name: " + name); if (!string.IsNullOrEmpty(value)) { SqlConnectionStringBuilder connectionString = new SqlConnectionStringBuilder(value); string realName = GetDatabaseName(connectionString); Log.Debug("WebConfig:AddDatabases(...)#realName: " + realName); if (!string.IsNullOrEmpty(realName)) { if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(realName)) { Database database = new Database { Name = name, RealName = realName, ConnectionString = connectionString }; databases.Add(database); } } } } } } }
public FakeInstance(DirectoryInfo webroot, DirectoryInfo dataFolder, Database[] databases) : this(webroot.FullName, dataFolder.FullName, databases) { }