示例#1
0
        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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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);
            }
        }
示例#5
0
 void IHostProviderRegistry.Register(IHostProvider hostProvider, HostProviderPriority priority)
 {
 }