public void LoadApplicationDataSetFromDB(Data.ApplicationDataSet applicationDS) { #if TRACE long startTicksTotal = VNC.AppLog.Trace("Start", LOG_APPNAME, BASE_ERRORNUMBER + 3); #endif try { long startTicks = 0; VNC.AppLog.Info("Clearing ApplicationDataSet...", LOG_APPNAME); applicationDS.Clear(); Common.DataFullyLoaded = false; LoadMainTables(applicationDS); // Load the rest of the tables Thread t = new Thread(() => LoadTablesInBackGround(applicationDS)); t.Start(); } catch (Exception ex) { VNC.AppLog.Error(string.Format("ConnectionString:>{0}<", Config.ConnectionString), LOG_APPNAME, BASE_ERRORNUMBER + 60); VNC.AppLog.Error(ex, LOG_APPNAME, BASE_ERRORNUMBER + 61); } #if TRACE VNC.AppLog.Trace("End", LOG_APPNAME, BASE_ERRORNUMBER + 62, startTicksTotal); #endif }
private void LoadTablesInBackGround(Data.ApplicationDataSet applicationDS) { // Might be able to do this in parallel after we figure out locking. // For now just do serially. //LoadInstanceContentTables(applicationDS); //LoadSnapShotTables(applicationDS); //LoadDBContentTables(applicationDS); //LoadJobServerTables(applicationDS); Thread t1 = new Thread(() => LoadInstanceContentTables(applicationDS)); t1.Start(); Thread t2 = new Thread(() => LoadSnapShotTables(applicationDS)); t2.Start(); Thread t3 = new Thread(() => LoadDBContentTables(applicationDS)); t3.Start(); Thread t4 = new Thread(() => LoadJobServerTables(applicationDS)); t4.Start(); Common.DataFullyLoaded = true; }
public void LoadApplicationDataSetFromDB(Data.ApplicationDataSet applicationDS) { #if TRACE long startTicksTotal = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif try { long startTicks = 0; if (Config.ADSLoad_Servers) { #if TRACE startTicks = PLLog.Trace2("Fill Servers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif // Intialize the TAManager and all the other TableAdapters by using the embedded ServersTableAdapter // See the Get method on TaManager. TaManager.ServersTableAdapter.Fill(applicationDS.Servers); #if TRACE PLLog.Trace2("End Fill Servers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_ServerInfo) { #if TRACE startTicks = PLLog.Trace2("Fill ServerInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif ServerInfoTA.Fill(applicationDS.ServerInfo); #if TRACE PLLog.Trace2("End Fill ServerInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_Instances) { #if TRACE startTicks = PLLog.Trace2("Fill Instances", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif InstancesTA.Fill(applicationDS.Instances); #if TRACE PLLog.Trace2("End Fill Instances", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_InstanceInfo) { #if TRACE startTicks = PLLog.Trace2("Fill InstanceInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif InstanceInfoTA.Fill(applicationDS.InstanceInfo); #if TRACE PLLog.Trace2("End Fill InstanceInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_Jobs) { #if TRACE startTicks = PLLog.Trace2("Fill Jobs", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif JobsTA.Fill(applicationDS.Jobs); #if TRACE PLLog.Trace2("End Fill Jobs", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_Logins) { #if TRACE startTicks = PLLog.Trace2("Fill Logins", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif LoginsTA.Fill(applicationDS.Logins); #if TRACE PLLog.Trace2("End Fill Logins", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_ServerRoles) { #if TRACE startTicks = PLLog.Trace2("Fill ServerRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif ServerRolesTA.Fill(applicationDS.ServerRoles); #if TRACE PLLog.Trace2("End Fill ServerRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_Databases) { #if TRACE startTicks = PLLog.Trace2("Fill Databases", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DatabasesTA.Fill(applicationDS.Databases); #if TRACE PLLog.Trace2("End Fill Databases", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DatabaseInfo) { #if TRACE startTicks = PLLog.Trace2("Fill DatabaseInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DatabaseInfoTA.Fill(applicationDS.DatabaseInfo); #if TRACE PLLog.Trace2("End Fill DatabaseInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBDataFiles) { #if TRACE startTicks = PLLog.Trace2("Fill DBDataFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBDataFilesTA.Fill(applicationDS.DBDataFiles);; #if TRACE PLLog.Trace2("End Fill DBDataFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBDataFileInfo) { #if TRACE startTicks = PLLog.Trace2("Fill DBDataFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBDataFileInfoTA.Fill(applicationDS.DBDataFileInfo); #if TRACE PLLog.Trace2("End Fill DBDataFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBDdlTriggers) { #if TRACE startTicks = PLLog.Trace2("Fill DBDdlTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBDdlTriggersTA.Fill(applicationDS.DBDdlTriggers); #if TRACE PLLog.Trace2("End Fill DBDdlTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBFileGroups) { #if TRACE startTicks = PLLog.Trace2("Fill DBFileGroups", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBFileGroupsTA.Fill(applicationDS.DBFileGroups); #if TRACE PLLog.Trace2("End Fill DBFileGroups", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBLogFiles) { #if TRACE startTicks = PLLog.Trace2("Fill DBLogFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBLogFilesTA.Fill(applicationDS.DBLogFiles); #if TRACE PLLog.Trace2("End Fill DBLogFiles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBLogFileInfo) { #if TRACE startTicks = PLLog.Trace2("Fill DBLogFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBLogFileInfoTA.Fill(applicationDS.DBLogFileInfo); #if TRACE PLLog.Trace2("End Fill DBLogFileInfo", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBRoles) { #if TRACE startTicks = PLLog.Trace2("Fill DBRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBRolesTA.Fill(applicationDS.DBRoles); } #if TRACE PLLog.Trace2("End Fill DBRoles", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif if (Config.ADSLoad_DBStoredProcedures) { #if TRACE startTicks = PLLog.Trace2("Fill DBStoredProcedures", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBStoredProceduresTA.Fill(applicationDS.DBStoredProcedures); #if TRACE PLLog.Trace2("End Fill DBStoredProcedures", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBTables) { #if TRACE startTicks = PLLog.Trace2("Fill DBTables", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBTablesTA.Fill(applicationDS.DBTables); #if TRACE PLLog.Trace2("End Fill DBTables", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBUserDefinedFunctions) { #if TRACE startTicks = PLLog.Trace2("Fill DBUserDefinedFunctions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBUserDefinedFunctionsTA.Fill(applicationDS.DBUserDefinedFunctions); #if TRACE PLLog.Trace2("End Fill DBUserDefinedFunctions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBUsers) { #if TRACE startTicks = PLLog.Trace2("Fill DBUsers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBUsersTA.Fill(applicationDS.DBUsers);; #if TRACE PLLog.Trace2("End Fill DBUsers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_DBViews) { #if TRACE startTicks = PLLog.Trace2("Fill DBViews", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif DBViewsTA.Fill(applicationDS.DBViews); #if TRACE PLLog.Trace2("End Fill DBViews", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_TBTriggers) { #if TRACE startTicks = PLLog.Trace2("Fill TBTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif TBTriggersTA.Fill(applicationDS.TBTriggers);; #if TRACE PLLog.Trace2("End Fill TBTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } if (Config.ADSLoad_VWTriggers) { #if TRACE startTicks = PLLog.Trace2("Fill VWTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif VWTriggersTA.Fill(applicationDS.VWTriggers); #if TRACE PLLog.Trace2("End Fill VWTriggers", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } #if TRACE startTicks = PLLog.Trace2("Fill LKUP_ADDomains", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif LU_ADDomainsTA.Fill(applicationDS.LKUP_ADDomains); #if TRACE PLLog.Trace2("End Fill LKUP_ADDomains", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif #if TRACE startTicks = PLLog.Trace2("Fill LKUP_Environments", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif LU_EnvironmentsTA.Fill(applicationDS.LKUP_Environments); #if TRACE PLLog.Trace2("End Fill LKUP_Environments", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif #if TRACE startTicks = PLLog.Trace2("Fill LKUP_SQLServerVersions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif LU_SQLServerVersionsTA.Fill(applicationDS.LKUP_SQLServerVersions); #if TRACE PLLog.Trace2("End Fill LKUP_SQLServerVersions", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif } catch (Exception ex) { PLLog.Error(string.Format("ConnectionString:>{0}<", Config.SQLMonitorDBConnection), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicksTotal); #endif }