/// <summary> /// Loads the TFS configuration. /// </summary> /// <param name="configRoot">The configuration root.</param> /// <exception cref="System.ArgumentException"></exception> protected void LoadTfsConfiguration(IConfigurationRoot configRoot) { var tfsConfig = new SystemInstances(); configRoot.Bind(tfsConfig); LoadTfsConfiguration(tfsConfig); }
protected void LoadTfsConfiguration(SystemInstances tfsConfig) { if (tfsConfig.IsValid == false) { throw new ArgumentException($"Tfs configuration is not valid: {tfsConfig.Instances?.Count} instances"); } var onlySupportsOneTfsInstance = tfsConfig.Instances.First(); var baseUrl = onlySupportsOneTfsInstance.InstanceUrl; if (onlySupportsOneTfsInstance.AutoLoadInstanceMetaData) { LogInfo("Auto loading Tfs instance metadata..."); RebuildTfsKnownElementsAsync(baseUrl).GetAwaiter().GetResult(); LogInfo("Auto load of Tfs instance metadata complete"); } else { LogInfo("Auto load of Tfs instance metadata was skipped"); TfsKnownElements = new TfsKnownElements(baseUrl); } }
/// <summary> /// Initializes a new instance of the <see cref="TfsWorkitemController"/> class. /// </summary> /// <param name="systemInstances">The TFS configuration.</param> public TfsWorkitemController(SystemInstances systemInstances) { LoadTfsConfiguration(systemInstances); }