Revert "Inherit web IHostingEnvironment and IApplicationEnvironment from the Generic Host one (#1461)" (#1467)

This reverts commit 8672b1b04a.
This commit is contained in:
Henk Mollema 2018-06-18 19:47:17 +02:00 committed by David Fowler
parent 8672b1b04a
commit cfab182399
4 changed files with 49 additions and 4 deletions

View File

@ -8,7 +8,30 @@ namespace Microsoft.AspNetCore.Hosting
/// <summary>
/// Allows consumers to perform cleanup during a graceful shutdown.
/// </summary>
public interface IApplicationLifetime : Extensions.Hosting.IApplicationLifetime
public interface IApplicationLifetime
{
/// <summary>
/// Triggered when the application host has fully started and is about to wait
/// for a graceful shutdown.
/// </summary>
CancellationToken ApplicationStarted { get; }
/// <summary>
/// Triggered when the application host is performing a graceful shutdown.
/// Requests may still be in flight. Shutdown will block until this event completes.
/// </summary>
CancellationToken ApplicationStopping { get; }
/// <summary>
/// Triggered when the application host is performing a graceful shutdown.
/// All requests should be complete at this point. Shutdown will block
/// until this event completes.
/// </summary>
CancellationToken ApplicationStopped { get; }
/// <summary>
/// Requests termination of the current application.
/// </summary>
void StopApplication();
}
}

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Hosting
/// <summary>
/// Provides information about the web hosting environment an application is running in.
/// </summary>
public interface IHostingEnvironment : Extensions.Hosting.IHostingEnvironment
public interface IHostingEnvironment
{
/// <summary>
/// Gets or sets the name of the environment. The host automatically sets this property to the value
/// of the "ASPNETCORE_ENVIRONMENT" environment variable, or "environment" as specified in any other configuration source.
/// </summary>
string EnvironmentName { get; set; }
/// <summary>
/// Gets or sets the name of the application. This property is automatically set by the host to the assembly containing
/// the application entry point.
/// </summary>
string ApplicationName { get; set; }
/// <summary>
/// Gets or sets the absolute path to the directory that contains the web-servable application content files.
/// </summary>
@ -19,5 +31,15 @@ namespace Microsoft.AspNetCore.Hosting
/// Gets or sets an <see cref="IFileProvider"/> pointing at <see cref="WebRootPath"/>.
/// </summary>
IFileProvider WebRootFileProvider { get; set; }
/// <summary>
/// Gets or sets the absolute path to the directory that contains the application content files.
/// </summary>
string ContentRootPath { get; set; }
/// <summary>
/// Gets or sets an <see cref="IFileProvider"/> pointing at <see cref="ContentRootPath"/>.
/// </summary>
IFileProvider ContentRootFileProvider { get; set; }
}
}

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
/// <summary>
/// Allows consumers to perform cleanup during a graceful shutdown.
/// </summary>
public class ApplicationLifetime : IApplicationLifetime
public class ApplicationLifetime : IApplicationLifetime, Extensions.Hosting.IApplicationLifetime
{
private readonly CancellationTokenSource _startedSource = new CancellationTokenSource();
private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource();

View File

@ -5,7 +5,7 @@ using Microsoft.Extensions.FileProviders;
namespace Microsoft.AspNetCore.Hosting.Internal
{
public class HostingEnvironment : IHostingEnvironment
public class HostingEnvironment : IHostingEnvironment, Extensions.Hosting.IHostingEnvironment
{
public string EnvironmentName { get; set; } = Hosting.EnvironmentName.Production;