React to aspnet/Congifuration #195,#198

This commit is contained in:
Kirthi Krishnamraju 2015-05-20 14:54:33 -07:00
parent 1566f72063
commit b75a855b98
9 changed files with 26 additions and 18 deletions

View File

@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Hosting.Server
{

View File

@ -2,7 +2,7 @@
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Abstractions": "1.0.0-*"
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-*"
},
"frameworks": {

View File

@ -11,7 +11,7 @@ using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;

View File

@ -6,7 +6,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Hosting
public void Main(string[] args)
{
var config = new Configuration();
var config = new ConfigurationSection();
if (File.Exists(HostingIniFile))
{
config.AddIniFile(HostingIniFile);

View File

@ -7,7 +7,7 @@ using Microsoft.AspNet.Hosting.Builder;
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;
@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Hosting
private string _serverFactoryLocation;
private IServerFactory _serverFactory;
public WebHostBuilder([NotNull] IServiceProvider services) : this(services, config: new Configuration()) { }
public WebHostBuilder([NotNull] IServiceProvider services) : this(services, config: new ConfigurationSection()) { }
public WebHostBuilder([NotNull] IServiceProvider services, [NotNull] IConfiguration config)
{

View File

@ -8,7 +8,10 @@
"Microsoft.AspNet.Hosting.Server.Abstractions": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.Configuration": "1.0.0-*",
"Microsoft.Framework.Configuration.CommandLine": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Configuration.Ini": "1.0.0-*",
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
"Microsoft.Framework.Logging": "1.0.0-*",
"Microsoft.Framework.Runtime.Abstractions": "1.0.0-*",

View File

@ -10,7 +10,7 @@ using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime.Infrastructure;
@ -79,7 +79,7 @@ namespace Microsoft.AspNet.TestHost
{
return new WebHostBuilder(
services ?? CallContextServiceLocator.Locator.ServiceProvider,
config ?? new Configuration());
config ?? new ConfigurationSection());
}
public static WebHostBuilder CreateBuilder()

View File

@ -14,7 +14,7 @@ using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Testing.xunit;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.OptionsModel;
@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Hosting
{ "server", "Microsoft.AspNet.Hosting.Tests" }
};
var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var host = CreateBuilder(config).Build();
host.Start();
@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Hosting
{ "Hosting:Server", "Microsoft.AspNet.Hosting.Tests" }
};
var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var host = CreateBuilder(config).Build();
host.Start();
@ -155,7 +155,7 @@ namespace Microsoft.AspNet.Hosting
{ "ASPNET_ENV", "Staging" }
};
var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var engine = CreateBuilder(config).Build();
@ -171,7 +171,7 @@ namespace Microsoft.AspNet.Hosting
{ "Hosting:Environment", "Staging" }
};
var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var engine = CreateBuilder(config).Build();
@ -380,7 +380,9 @@ namespace Microsoft.AspNet.Hosting
private WebHostBuilder CreateBuilder(IConfiguration config = null)
{
return new WebHostBuilder(CallContextServiceLocator.Locator.ServiceProvider, config ?? new Configuration());
return new WebHostBuilder(
CallContextServiceLocator.Locator.ServiceProvider,
config ?? new ConfigurationSection());
}
public IServerInformation Initialize(IConfiguration configuration)

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime.Infrastructure;
@ -34,7 +34,10 @@ namespace Microsoft.AspNet.TestHost
var services = new ServiceCollection().BuildServiceProvider();
// Act & Assert
Assert.Throws<InvalidOperationException>(() => TestServer.Create(services, new Configuration(), new Startup().Configure, configureServices: null));
Assert.Throws<InvalidOperationException>(
() => TestServer.Create(
services,
new ConfigurationSection(), new Startup().Configure, configureServices: null));
}
[Fact]