Ejemplo n.º 1
0
        private object GetClientOptions(AzureClientsGlobalOptions globalOptions, IConfiguration section)
        {
            var clientOptions = (ClientOptions)ClientFactory.CreateClientOptions(null, _clientOptionType);

            foreach (var globalConfigureOptions in globalOptions.ConfigureOptionDelegates)
            {
                globalConfigureOptions(clientOptions, _serviceProvider);
            }

            section.Bind(clientOptions);

            return(clientOptions);
        }
        public override object CreateClientOptions(Type optionsType, object serviceVersion, IConfiguration configuration)
        {
            var options = ClientFactory.CreateClientOptions(serviceVersion, optionsType);

            if (options is ClientOptions clientOptions)
            {
                foreach (var globalConfigureOption in _globalOptions.CurrentValue.ConfigureOptionDelegates)
                {
                    globalConfigureOption(clientOptions, _serviceProvider);
                }
            }
            configuration?.Bind(options);
            return(options);
        }
Ejemplo n.º 3
0
        private TOptions CreateOptions(string name)
        {
            object version = null;

            foreach (var clientRegistration in _clientRegistrations)
            {
                if (clientRegistration.Name == name)
                {
                    version = clientRegistration.Version;
                }
            }

            return((TOptions)ClientFactory.CreateClientOptions(version, typeof(TOptions)));
        }
        private TOptions CreateOptions(string name)
        {
            object version = null;

            foreach (var clientRegistration in _clientRegistrations)
            {
                if (clientRegistration.Name == name)
                {
                    version = clientRegistration.Version;
                }
            }

            var options = (TOptions)ClientFactory.CreateClientOptions(version, typeof(TOptions));

            if (options is ClientOptions clientOptions)
            {
                foreach (var globalConfigureOption in _defaultOptions.Value.ConfigureOptionDelegates)
                {
                    globalConfigureOption(clientOptions, _serviceProvider);
                }
            }

            return(options);
        }