public void Register(IHostProvider hostProvider, HostProviderPriority priority) { EnsureArgument.NotNull(hostProvider, nameof(hostProvider)); if (StringComparer.OrdinalIgnoreCase.Equals(hostProvider.Id, Constants.ProviderIdAuto)) { throw new ArgumentException( $"A host provider cannot be registered with the ID '{Constants.ProviderIdAuto}'", nameof(hostProvider)); } if (hostProvider.SupportedAuthorityIds.Any(y => StringComparer.OrdinalIgnoreCase.Equals(y, Constants.AuthorityIdAuto))) { throw new ArgumentException( $"A host provider cannot be registered with the legacy authority ID '{Constants.AuthorityIdAuto}'", nameof(hostProvider)); } if (!_hostProviders.TryGetValue(priority, out ICollection <IHostProvider> providers)) { providers = new List <IHostProvider>(); _hostProviders[priority] = providers; } providers.Add(hostProvider); }
public void RegisterProvider(IHostProvider provider, HostProviderPriority priority) { _providerRegistry.Register(provider, priority); // If the provider is also a configurable component, add that to the configuration service if (provider is IConfigurableComponent configurableProvider) { _configurationService.AddComponent(configurableProvider); } }
public void RegisterProvider(IHostProvider provider, HostProviderPriority priority) { _providerRegistry.Register(provider, priority); // If the provider is also a configurable component, add that to the configuration service if (provider is IConfigurableComponent configurableProvider) { _configurationService.AddComponent(configurableProvider); } // If the provider has custom commands to offer then create them here if (provider is ICommandProvider cmdProvider) { ProviderCommand providerCommand = cmdProvider.CreateCommand(); _providerCommands.Add(providerCommand); } }
public void RegisterProvider(IHostProvider provider, HostProviderPriority priority) { _providerRegistry.Register(provider, priority); // If the provider is also a configurable component, add that to the configuration service if (provider is IConfigurableComponent configurableProvider) { _configurationService.AddComponent(configurableProvider); } // If the provider has custom commands to offer then create them here if (provider is ICommandProvider cmdProvider) { ProviderCommand providerCommand = cmdProvider.CreateCommand(); _providerCommands.Add(providerCommand); } // If the provider exposes custom diagnostics use them if (provider is IDiagnosticProvider diagnosticProvider) { IEnumerable <IDiagnostic> providerDiagnostics = diagnosticProvider.GetDiagnostics(); _diagnostics.AddRange(providerDiagnostics); } }
void IHostProviderRegistry.Register(IHostProvider hostProvider, HostProviderPriority priority) { }