From 06cfdcaf2313aac076f878022154064598d5555b Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 25 Feb 2016 17:38:11 -0800 Subject: [PATCH] Removing duplicated extension for creating enumerable configuration --- .../Internal/IConfigurationExtensions.cs | 34 ------------------- .../WebHostBuilderExtensions.cs | 2 +- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Hosting/Internal/IConfigurationExtensions.cs diff --git a/src/Microsoft.AspNetCore.Hosting/Internal/IConfigurationExtensions.cs b/src/Microsoft.AspNetCore.Hosting/Internal/IConfigurationExtensions.cs deleted file mode 100644 index e1565878ac..0000000000 --- a/src/Microsoft.AspNetCore.Hosting/Internal/IConfigurationExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.Extensions.Configuration; - -namespace Microsoft.AspNetCore.Hosting.Internal -{ - public static class IConfigurationExtensions - { - // Temporary until Configuration/issues/370 is implemented. - public static IEnumerable> GetFlattenedSettings(this IConfiguration configuration) - { - var stack = new Stack(); - stack.Push(configuration); - - while (stack.Count > 0) - { - var config = stack.Pop(); - var section = config as IConfigurationSection; - - if (section != null) - { - yield return new KeyValuePair(section.Path, section.Value); - } - - foreach (var child in config.GetChildren()) - { - stack.Push(child); - } - } - } - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs index 74141cf20d..347eb846a0 100644 --- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Hosting public static IWebHostBuilder UseConfiguration(this IWebHostBuilder builder, IConfiguration configuration) { - foreach (var setting in configuration.GetFlattenedSettings()) + foreach (var setting in configuration.AsEnumerable()) { builder.UseSetting(setting.Key, setting.Value); }