void m_worker_DoWork(object sender, DoWorkEventArgs e) { Debug.Assert(e.Argument is MigrationSource, "Wrong argument type"); MigrationSource migrationSourceConfig = e.Argument as MigrationSource; string dbSet = migrationSourceConfig.ServerUrl; string userDb = migrationSourceConfig.SourceIdentifier; CredentialManagementService credManagementService = new CredentialManagementService(migrationSourceConfig); ICQLoginCredentialManager loginCredManager = CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig); ClearQuestConnectionConfig userSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName, loginCredManager.Password, userDb, dbSet); ClearQuestOleServer.Session userSession = CQConnectionFactory.GetUserSession(userSessionConnConfig); Dictionary <string, bool> queryList = CQWorkSpace.GetQueryListWithValidity(userSession); e.Result = queryList; }
public void Initialize(Configuration configuration) { CredentialManagementService credManagementService = new CredentialManagementService(configuration); foreach (MigrationSource ms in configuration.SessionGroup.MigrationSources.MigrationSource) { try { string dbSet = ms.ServerUrl; string userDb = ms.SourceIdentifier; ICQLoginCredentialManager loginCredManager = CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, ms); Guid migrSrcId = new Guid(ms.InternalUniqueId); var userSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName, loginCredManager.Password, userDb, dbSet); ClearQuestOleServer.Session userSession = CQConnectionFactory.GetUserSession(userSessionConnConfig); if (!m_cqSessions.ContainsKey(migrSrcId)) { m_cqSessions.Add(migrSrcId, userSession); } } catch (ClearQuestInvalidConfigurationException) { continue; } catch (Exception e) { TraceManager.TraceException(e); } } }