#329 Change IServerInformation to IFeatureCollection.
This commit is contained in:
parent
adae42b66f
commit
25b5a42ca6
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Hosting.Server
|
||||||
{
|
{
|
||||||
public interface IServerFactory
|
public interface IServerFactory
|
||||||
{
|
{
|
||||||
IServerInformation Initialize(IConfiguration configuration);
|
IFeatureCollection Initialize(IConfiguration configuration);
|
||||||
IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application);
|
IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Hosting.Internal
|
||||||
// Only one of these should be set
|
// Only one of these should be set
|
||||||
internal IServerFactory ServerFactory { get; set; }
|
internal IServerFactory ServerFactory { get; set; }
|
||||||
internal string ServerFactoryLocation { get; set; }
|
internal string ServerFactoryLocation { get; set; }
|
||||||
private IServerInformation _serverInstance;
|
private IFeatureCollection _serverInstance;
|
||||||
|
|
||||||
public HostingEngine(
|
public HostingEngine(
|
||||||
[NotNull] IServiceCollection appServices,
|
[NotNull] IServiceCollection appServices,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.TestHost
|
||||||
{
|
{
|
||||||
private const string DefaultEnvironmentName = "Development";
|
private const string DefaultEnvironmentName = "Development";
|
||||||
private const string ServerName = nameof(TestServer);
|
private const string ServerName = nameof(TestServer);
|
||||||
private static readonly ServerInformation ServerInfo = new ServerInformation();
|
private static readonly IFeatureCollection ServerInfo = new FeatureCollection();
|
||||||
private Func<IFeatureCollection, Task> _appDelegate;
|
private Func<IFeatureCollection, Task> _appDelegate;
|
||||||
private IDisposable _appInstance;
|
private IDisposable _appInstance;
|
||||||
private bool _disposed = false;
|
private bool _disposed = false;
|
||||||
|
|
@ -107,18 +107,13 @@ namespace Microsoft.AspNet.TestHost
|
||||||
return new RequestBuilder(this, path);
|
return new RequestBuilder(this, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IServerInformation Initialize(IConfiguration configuration)
|
public IFeatureCollection Initialize(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
return ServerInfo;
|
return ServerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application)
|
public IDisposable Start(IFeatureCollection serverInformation, Func<IFeatureCollection, Task> application)
|
||||||
{
|
{
|
||||||
if (!(serverInformation.GetType() == typeof(ServerInformation)))
|
|
||||||
{
|
|
||||||
throw new ArgumentException(string.Format("The server must be {0}", ServerName), "serverInformation");
|
|
||||||
}
|
|
||||||
|
|
||||||
_appDelegate = application;
|
_appDelegate = application;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -138,13 +133,5 @@ namespace Microsoft.AspNet.TestHost
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
_appInstance.Dispose();
|
_appInstance.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ServerInformation : IServerInformation
|
|
||||||
{
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return ServerName; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -368,12 +368,12 @@ namespace Microsoft.AspNet.Hosting
|
||||||
config ?? new ConfigurationBuilder().Build());
|
config ?? new ConfigurationBuilder().Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IServerInformation Initialize(IConfiguration configuration)
|
public IFeatureCollection Initialize(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application)
|
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
|
||||||
{
|
{
|
||||||
var startInstance = new StartInstance(application);
|
var startInstance = new StartInstance(application);
|
||||||
_startInstances.Add(startInstance);
|
_startInstances.Add(startInstance);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue