Add XML docs to IHttpContextAccessor and IHttpContextFactory (#14747)

This commit is contained in:
Jordy Sipkema 2019-10-07 17:51:33 +02:00 committed by Justin Kotalik
parent 0a79d34f62
commit 4e79a278e3
2 changed files with 24 additions and 1 deletions

View File

@ -3,8 +3,18 @@
namespace Microsoft.AspNetCore.Http
{
/// <summary>
/// Provides access to the current <see cref="HttpContext"/>, if one is available.
/// </summary>
/// <remarks>
/// This interface should be used with caution. It relies on <see cref="System.Threading.AsyncLocal{T}" /> which can have a negative performance impact on async calls.
/// It also creates a dependency on "ambient state" which can make testing more difficult.
/// </remarks>
public interface IHttpContextAccessor
{
/// <summary>
/// Gets or sets the current <see cref="HttpContext"/>. Returns <see langword="null" /> if there is no active <see cref="HttpContext" />.
/// </summary>
HttpContext HttpContext { get; set; }
}
}
}

View File

@ -5,9 +5,22 @@ using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Http
{
/// <summary>
/// Provides methods to create and dispose of <see cref="HttpContext"/> instances.
/// </summary>
public interface IHttpContextFactory
{
/// <summary>
/// Creates an <see cref="HttpContext"/> instance for the specified set of HTTP features.
/// </summary>
/// <param name="featureCollection">The collection of HTTP features to set on the created instance.</param>
/// <returns>The <see cref="HttpContext"/> instance.</returns>
HttpContext Create(IFeatureCollection featureCollection);
/// <summary>
/// Releases resources held by the <see cref="HttpContext"/>.
/// </summary>
/// <param name="httpContext">The <see cref="HttpContext"/> to dispose.</param>
void Dispose(HttpContext httpContext);
}
}