diff --git a/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerFactory.cs b/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerFactory.cs index 09c696b8..ff188af7 100644 --- a/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerFactory.cs +++ b/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerFactory.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Hosting.Server { public interface IServerFactory { - IServerInformation Initialize(IConfiguration configuration); - IDisposable Start(IServerInformation serverInformation, Func application); + IFeatureCollection Initialize(IConfiguration configuration); + IDisposable Start(IFeatureCollection serverFeatures, Func application); } } diff --git a/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerInformation.cs b/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerInformation.cs deleted file mode 100644 index 2e3af1e7..00000000 --- a/src/Microsoft.AspNet.Hosting.Server.Abstractions/IServerInformation.cs +++ /dev/null @@ -1,10 +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. - -namespace Microsoft.AspNet.Hosting.Server -{ - public interface IServerInformation - { - string Name { get; } - } -} diff --git a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs index 4af23ea6..d072b362 100644 --- a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs +++ b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs @@ -36,7 +36,7 @@ public class HostingEngine : IHostingEngine // Only one of these should be set internal IServerFactory ServerFactory { get; set; } internal string ServerFactoryLocation { get; set; } - private IServerInformation _serverInstance; + private IFeatureCollection _serverInstance; public HostingEngine( [NotNull] IServiceCollection appServices, diff --git a/src/Microsoft.AspNet.TestHost/TestServer.cs b/src/Microsoft.AspNet.TestHost/TestServer.cs index 571ceb26..80efe05f 100644 --- a/src/Microsoft.AspNet.TestHost/TestServer.cs +++ b/src/Microsoft.AspNet.TestHost/TestServer.cs @@ -19,7 +19,7 @@ public class TestServer : IServerFactory, IDisposable { private const string DefaultEnvironmentName = "Development"; private const string ServerName = nameof(TestServer); - private static readonly ServerInformation ServerInfo = new ServerInformation(); + private static readonly IFeatureCollection ServerInfo = new FeatureCollection(); private Func _appDelegate; private IDisposable _appInstance; private bool _disposed = false; @@ -107,18 +107,13 @@ public RequestBuilder CreateRequest(string path) return new RequestBuilder(this, path); } - public IServerInformation Initialize(IConfiguration configuration) + public IFeatureCollection Initialize(IConfiguration configuration) { return ServerInfo; } - public IDisposable Start(IServerInformation serverInformation, Func application) + public IDisposable Start(IFeatureCollection serverInformation, Func application) { - if (!(serverInformation.GetType() == typeof(ServerInformation))) - { - throw new ArgumentException(string.Format("The server must be {0}", ServerName), "serverInformation"); - } - _appDelegate = application; return this; @@ -138,13 +133,5 @@ public void Dispose() _disposed = true; _appInstance.Dispose(); } - - private class ServerInformation : IServerInformation - { - public string Name - { - get { return ServerName; } - } - } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs index a33e7367..5b9c50ba 100644 --- a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs +++ b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs @@ -368,12 +368,12 @@ private WebHostBuilder CreateBuilder(IConfiguration config = null) config ?? new ConfigurationBuilder().Build()); } - public IServerInformation Initialize(IConfiguration configuration) + public IFeatureCollection Initialize(IConfiguration configuration) { return null; } - public IDisposable Start(IServerInformation serverInformation, Func application) + public IDisposable Start(IFeatureCollection serverFeatures, Func application) { var startInstance = new StartInstance(application); _startInstances.Add(startInstance);