private void connectButton_Click(object sender, EventArgs e) { sqlConnBuilder = loginControl.GetConnectionStringBuilder(); inspector = DbInspector.GetInstance(sqlConnBuilder); try { serverStructure = inspector.InitStructure(); inspector.LoadData(); dbComboBox.DataSource = serverStructure.Databases; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public void AutoExploreTest() { SystemMapEntities smdb = new SystemMapEntities(); string dbstring = smdb.Database.Connection.ConnectionString; SqlConnectionStringBuilder cbuilder = new SqlConnectionStringBuilder(dbstring); DbInspector sqlInspector = DbInspector.GetInstance(cbuilder); DataServerStructure serverData = sqlInspector.InitStructure(); sqlInspector.LoadData(); Assert.IsTrue(serverData.Databases.Count > 0); foreach (DataSourceStructure dbstruct in serverData.Databases) { if (dbstruct.DataSource.Name.Equals("SystemMap")) { sqlInspector.LoadDataSource(dbstruct); Assert.IsTrue(dbstruct.Nodes.Count > 0); Assert.IsTrue(dbstruct.Relationships.Count > 0); } } }