Example #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);
        }
Example #2
0
        /// <summary>
        /// Get provider configuration options
        /// </summary>
        /// <param name="provider"></param>
        /// <returns></returns>
        public virtual ProviderOptionsDto GetProviderOptions([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)
            {
                providerOptions.Values.Add(new ProviderValueDto(kv.Key, L[kv.Key], kv.Value.Type, kv.Value.Note));
            }

            return(providerOptions);
        }
        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);
        }