コード例 #1
0
        public virtual ProviderOptionsDto GetOptions([NotNull] string provider)
        {
            Check.NotNullOrWhiteSpace(provider, nameof(provider));

            var fileProviderConfiguration = Options.Providers.GetConfiguration(provider);

            if (fileProviderConfiguration == null)
            {
                throw new UserFriendlyException($"Could not get provider configuration by name '{provider}'.");
            }

            var values          = fileProviderConfiguration.GetValues();
            var providerOptions = new ProviderOptionsDto(provider);

            foreach (var kv in values)
            {
                var providerValue = new ProviderValueDto(
                    kv.Key, L[kv.Key],
                    TypeHelper.GetFullNameHandlingNullableAndGenerics(kv.Value.Type),
                    kv.Value.Note);

                providerOptions.Values.Add(providerValue);
            }

            return(providerOptions);
        }
コード例 #2
0
        public virtual ProviderOptionsDto GetOptions([NotNull] string provider)
        {
            Check.NotNullOrWhiteSpace(provider, nameof(provider));

            var fileProviderConfiguration = Options.Providers.GetConfiguration(provider);
            var values          = fileProviderConfiguration.GetValues();
            var providerOptions = new ProviderOptionsDto(provider);

            foreach (var kv in values)
            {
                var providerValue = new ProviderValueDto(
                    kv.Key, L[kv.Key],
                    TypeHelper.GetFullNameHandlingNullableAndGenerics(kv.Value.Type),
                    kv.Value.Note);

                providerOptions.Values.Add(providerValue);
            }

            return(providerOptions);
        }