React to aspnet/Congifuration #195,#198
This commit is contained in:
parent
1566f72063
commit
b75a855b98
|
|
@ -4,7 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.FeatureModel;
|
using Microsoft.AspNet.FeatureModel;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Hosting.Server
|
namespace Microsoft.AspNet.Hosting.Server
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
|
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
|
||||||
"Microsoft.Framework.ConfigurationModel.Abstractions": "1.0.0-*"
|
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-*"
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNet.Hosting.Server;
|
||||||
using Microsoft.AspNet.Hosting.Startup;
|
using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Features;
|
using Microsoft.AspNet.Http.Features;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Internal;
|
using Microsoft.Framework.Internal;
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Hosting.Internal;
|
using Microsoft.AspNet.Hosting.Internal;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Runtime;
|
using Microsoft.Framework.Runtime;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
|
|
||||||
public void Main(string[] args)
|
public void Main(string[] args)
|
||||||
{
|
{
|
||||||
var config = new Configuration();
|
var config = new ConfigurationSection();
|
||||||
if (File.Exists(HostingIniFile))
|
if (File.Exists(HostingIniFile))
|
||||||
{
|
{
|
||||||
config.AddIniFile(HostingIniFile);
|
config.AddIniFile(HostingIniFile);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNet.Hosting.Builder;
|
||||||
using Microsoft.AspNet.Hosting.Internal;
|
using Microsoft.AspNet.Hosting.Internal;
|
||||||
using Microsoft.AspNet.Hosting.Server;
|
using Microsoft.AspNet.Hosting.Server;
|
||||||
using Microsoft.AspNet.Hosting.Startup;
|
using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Internal;
|
using Microsoft.Framework.Internal;
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
private string _serverFactoryLocation;
|
private string _serverFactoryLocation;
|
||||||
private IServerFactory _serverFactory;
|
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)
|
public WebHostBuilder([NotNull] IServiceProvider services, [NotNull] IConfiguration config)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@
|
||||||
"Microsoft.AspNet.Hosting.Server.Abstractions": "1.0.0-*",
|
"Microsoft.AspNet.Hosting.Server.Abstractions": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Http": "1.0.0-*",
|
"Microsoft.AspNet.Http": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Http.Extensions": "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.DependencyInjection": "1.0.0-*",
|
||||||
"Microsoft.Framework.Logging": "1.0.0-*",
|
"Microsoft.Framework.Logging": "1.0.0-*",
|
||||||
"Microsoft.Framework.Runtime.Abstractions": "1.0.0-*",
|
"Microsoft.Framework.Runtime.Abstractions": "1.0.0-*",
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.AspNet.Hosting.Server;
|
using Microsoft.AspNet.Hosting.Server;
|
||||||
using Microsoft.AspNet.Hosting.Startup;
|
using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Runtime.Infrastructure;
|
using Microsoft.Framework.Runtime.Infrastructure;
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ namespace Microsoft.AspNet.TestHost
|
||||||
{
|
{
|
||||||
return new WebHostBuilder(
|
return new WebHostBuilder(
|
||||||
services ?? CallContextServiceLocator.Locator.ServiceProvider,
|
services ?? CallContextServiceLocator.Locator.ServiceProvider,
|
||||||
config ?? new Configuration());
|
config ?? new ConfigurationSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WebHostBuilder CreateBuilder()
|
public static WebHostBuilder CreateBuilder()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Features;
|
using Microsoft.AspNet.Http.Features;
|
||||||
using Microsoft.AspNet.Testing.xunit;
|
using Microsoft.AspNet.Testing.xunit;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
|
|
@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
{ "server", "Microsoft.AspNet.Hosting.Tests" }
|
{ "server", "Microsoft.AspNet.Hosting.Tests" }
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = new Configuration()
|
var config = new ConfigurationSection()
|
||||||
.Add(new MemoryConfigurationSource(vals));
|
.Add(new MemoryConfigurationSource(vals));
|
||||||
var host = CreateBuilder(config).Build();
|
var host = CreateBuilder(config).Build();
|
||||||
host.Start();
|
host.Start();
|
||||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
{ "Hosting:Server", "Microsoft.AspNet.Hosting.Tests" }
|
{ "Hosting:Server", "Microsoft.AspNet.Hosting.Tests" }
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = new Configuration()
|
var config = new ConfigurationSection()
|
||||||
.Add(new MemoryConfigurationSource(vals));
|
.Add(new MemoryConfigurationSource(vals));
|
||||||
var host = CreateBuilder(config).Build();
|
var host = CreateBuilder(config).Build();
|
||||||
host.Start();
|
host.Start();
|
||||||
|
|
@ -155,7 +155,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
{ "ASPNET_ENV", "Staging" }
|
{ "ASPNET_ENV", "Staging" }
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = new Configuration()
|
var config = new ConfigurationSection()
|
||||||
.Add(new MemoryConfigurationSource(vals));
|
.Add(new MemoryConfigurationSource(vals));
|
||||||
|
|
||||||
var engine = CreateBuilder(config).Build();
|
var engine = CreateBuilder(config).Build();
|
||||||
|
|
@ -171,7 +171,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
{ "Hosting:Environment", "Staging" }
|
{ "Hosting:Environment", "Staging" }
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = new Configuration()
|
var config = new ConfigurationSection()
|
||||||
.Add(new MemoryConfigurationSource(vals));
|
.Add(new MemoryConfigurationSource(vals));
|
||||||
|
|
||||||
var engine = CreateBuilder(config).Build();
|
var engine = CreateBuilder(config).Build();
|
||||||
|
|
@ -380,7 +380,9 @@ namespace Microsoft.AspNet.Hosting
|
||||||
|
|
||||||
private WebHostBuilder CreateBuilder(IConfiguration config = null)
|
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)
|
public IServerInformation Initialize(IConfiguration configuration)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.Configuration;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
using Microsoft.Framework.Runtime.Infrastructure;
|
using Microsoft.Framework.Runtime.Infrastructure;
|
||||||
|
|
@ -34,7 +34,10 @@ namespace Microsoft.AspNet.TestHost
|
||||||
var services = new ServiceCollection().BuildServiceProvider();
|
var services = new ServiceCollection().BuildServiceProvider();
|
||||||
|
|
||||||
// Act & Assert
|
// 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]
|
[Fact]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue