/// <summary> /// attach to one of the databases in the specified <see cref="SqlServerInfo"/> /// </summary> /// <param name="serverInfo"></param> /// <param name="idx"></param> public SqlDbInfo(SqlServerInfo serverInfo, string dbName, bool fetchDetails = false) : this(serverInfo.ServerName, serverInfo.InstanceName, dbName, fetchDetails) { this.UseIntegratedSecurity = serverInfo.UseIntegratedSecurity; this.PWD = serverInfo.PWD; this.UID = serverInfo.UID; }
/// <summary> /// searches for and adds discovered sql servers. /// </summary> protected override void QueryNodes() { try { this.IsBusy = true; this.Owner.IsBusy = true; foreach (var info in SqlServerInfo.GetDataSources(false).OrderBy((i) => i.ServerName)) { // construct the server info model: var serverModel = new SqlServerViewModel(info) { Owner = this.Owner }; // add it to the nodes collection: SafeInvoke(() => Nodes.Add(serverModel)); } } finally { this.IsBusy = false; this.Owner.IsBusy = false; } }
/// <summary> /// construct from one of the database records in a <see cref="SqlServerInfo"/> /// </summary> /// <param name="serverInfo"></param> /// <param name="idx"></param> public SqlDbInfo(SqlServerInfo serverInfo, int idx) : this(serverInfo.ServerName, serverInfo.InstanceName, serverInfo.Databases[idx].DataBaseName) { this.UseIntegratedSecurity = serverInfo.UseIntegratedSecurity; this.PWD = serverInfo.PWD; this.UID = serverInfo.UID; }