Updating descriptions to add parameters

#17204
This commit is contained in:
Dairai Nyabando 2019-11-22 22:27:55 -05:00
parent 66613b194d
commit 5dcb568df0
4 changed files with 46 additions and 4 deletions

View File

@ -31,6 +31,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is CONNECT. /// Verifies the HTTP request method is CONNECT.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsConnect(string method) public static bool IsConnect(string method)
{ {
return object.ReferenceEquals(Connect, method) || StringComparer.OrdinalIgnoreCase.Equals(Connect, method); return object.ReferenceEquals(Connect, method) || StringComparer.OrdinalIgnoreCase.Equals(Connect, method);
@ -39,6 +40,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is DELETE. /// Verifies the HTTP request method is DELETE.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsDelete(string method) public static bool IsDelete(string method)
{ {
return object.ReferenceEquals(Delete, method) || StringComparer.OrdinalIgnoreCase.Equals(Delete, method); return object.ReferenceEquals(Delete, method) || StringComparer.OrdinalIgnoreCase.Equals(Delete, method);
@ -47,6 +49,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is GET. /// Verifies the HTTP request method is GET.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsGet(string method) public static bool IsGet(string method)
{ {
return object.ReferenceEquals(Get, method) || StringComparer.OrdinalIgnoreCase.Equals(Get, method); return object.ReferenceEquals(Get, method) || StringComparer.OrdinalIgnoreCase.Equals(Get, method);
@ -55,6 +58,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is HEAD. /// Verifies the HTTP request method is HEAD.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsHead(string method) public static bool IsHead(string method)
{ {
return object.ReferenceEquals(Head, method) || StringComparer.OrdinalIgnoreCase.Equals(Head, method); return object.ReferenceEquals(Head, method) || StringComparer.OrdinalIgnoreCase.Equals(Head, method);
@ -63,6 +67,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is OPTIONS. /// Verifies the HTTP request method is OPTIONS.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsOptions(string method) public static bool IsOptions(string method)
{ {
return object.ReferenceEquals(Options, method) || StringComparer.OrdinalIgnoreCase.Equals(Options, method); return object.ReferenceEquals(Options, method) || StringComparer.OrdinalIgnoreCase.Equals(Options, method);
@ -71,6 +76,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is PATCH. /// Verifies the HTTP request method is PATCH.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsPatch(string method) public static bool IsPatch(string method)
{ {
return object.ReferenceEquals(Patch, method) || StringComparer.OrdinalIgnoreCase.Equals(Patch, method); return object.ReferenceEquals(Patch, method) || StringComparer.OrdinalIgnoreCase.Equals(Patch, method);
@ -79,6 +85,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is POST. /// Verifies the HTTP request method is POST.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsPost(string method) public static bool IsPost(string method)
{ {
return object.ReferenceEquals(Post, method) || StringComparer.OrdinalIgnoreCase.Equals(Post, method); return object.ReferenceEquals(Post, method) || StringComparer.OrdinalIgnoreCase.Equals(Post, method);
@ -87,6 +94,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is PUT. /// Verifies the HTTP request method is PUT.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsPut(string method) public static bool IsPut(string method)
{ {
return object.ReferenceEquals(Put, method) || StringComparer.OrdinalIgnoreCase.Equals(Put, method); return object.ReferenceEquals(Put, method) || StringComparer.OrdinalIgnoreCase.Equals(Put, method);
@ -95,6 +103,7 @@ namespace Microsoft.AspNetCore.Http
/// <summary> /// <summary>
/// Verifies the HTTP request method is TRACE. /// Verifies the HTTP request method is TRACE.
/// <summary/> /// <summary/>
/// <param name="method">HTTP request method.</param>
public static bool IsTrace(string method) public static bool IsTrace(string method)
{ {
return object.ReferenceEquals(Trace, method) || StringComparer.OrdinalIgnoreCase.Equals(Trace, method); return object.ReferenceEquals(Trace, method) || StringComparer.OrdinalIgnoreCase.Equals(Trace, method);

View File

@ -14,7 +14,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Http namespace Microsoft.AspNetCore.Http
{ {
/// <summary> /// <summary>
/// Represents an implementation of the HTTP Context class with HTTP-specific information for a request. /// Represents an implementation of the HTTP Context class.
/// <summary/> /// <summary/>
public sealed class DefaultHttpContext : HttpContext public sealed class DefaultHttpContext : HttpContext
{ {
@ -47,8 +47,9 @@ namespace Microsoft.AspNetCore.Http
} }
/// <summary> /// <summary>
/// Initializes a new instance of the DefaultHttpContext class with the using a collection of AspNetCore.Http.Features. /// Initializes a new instance of the DefaultHttpContext class with options passed in.
/// <summary/> /// <summary/>
/// <param name="features">Options to set when instantianting the Default HTTP context object.</param>
public DefaultHttpContext(IFeatureCollection features) public DefaultHttpContext(IFeatureCollection features)
{ {
_features.Initalize(features); _features.Initalize(features);
@ -57,8 +58,9 @@ namespace Microsoft.AspNetCore.Http
} }
/// <summary> /// <summary>
/// Initialize the current instant of the class with the using a collection of AspNetCore.Http.Features. /// Initialize the current instant of the class with options passed in.
/// <summary/> /// <summary/>
/// <param name="features">Options to initialize the Default HTTP context object.</param>
public void Initialize(IFeatureCollection features) public void Initialize(IFeatureCollection features)
{ {
var revision = features.Revision; var revision = features.Revision;

View File

@ -6,7 +6,7 @@ using System.Threading;
namespace Microsoft.AspNetCore.Http namespace Microsoft.AspNetCore.Http
{ {
/// <summary> /// <summary>
/// Represents the properties and methods used to keep access the current HTTP context. /// Represents the properties and methods used to access the current HTTP context.
/// <summary/> /// <summary/>
public class HttpContextAccessor : IHttpContextAccessor public class HttpContextAccessor : IHttpContextAccessor
{ {

View File

@ -8,6 +8,9 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Http namespace Microsoft.AspNetCore.Http
{ {
/// <summary>
/// Represents methods used to create an HTTP context object.
/// <summary/>
[Obsolete("This is obsolete and will be removed in a future version. Use DefaultHttpContextFactory instead.")] [Obsolete("This is obsolete and will be removed in a future version. Use DefaultHttpContextFactory instead.")]
public class HttpContextFactory : IHttpContextFactory public class HttpContextFactory : IHttpContextFactory
{ {
@ -15,21 +18,41 @@ namespace Microsoft.AspNetCore.Http
private readonly FormOptions _formOptions; private readonly FormOptions _formOptions;
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
/// <summary>
/// Initializes a new instance of the HttpContext class with options passed in.
/// <summary/>
/// <param name="formOptions">Options to set when instantianting the HTTP context object.</param>
public HttpContextFactory(IOptions<FormOptions> formOptions) public HttpContextFactory(IOptions<FormOptions> formOptions)
: this(formOptions, serviceScopeFactory: null) : this(formOptions, serviceScopeFactory: null)
{ {
} }
/// <summary>
/// Initializes a new instance of the DefaultHttpContext class with options passed in.
/// <summary/>
/// <param name="formOptions">Options to set when instantianting the HTTP context object.</param>
/// <param name="serviceScopeFactory">Factory object used to create the service scope for the HTTP context.</param>
public HttpContextFactory(IOptions<FormOptions> formOptions, IServiceScopeFactory serviceScopeFactory) public HttpContextFactory(IOptions<FormOptions> formOptions, IServiceScopeFactory serviceScopeFactory)
: this(formOptions, serviceScopeFactory, httpContextAccessor: null) : this(formOptions, serviceScopeFactory, httpContextAccessor: null)
{ {
} }
/// <summary>
/// Initializes a new instance of the DefaultHttpContext class with options passed in.
/// <summary/>
/// <param name="formOptions">Options to set when instantianting the HTTP context object.</param>
/// <param name="httpContextAccessor">Object to be used to access the HTTP context instance.</param>
public HttpContextFactory(IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor) public HttpContextFactory(IOptions<FormOptions> formOptions, IHttpContextAccessor httpContextAccessor)
: this(formOptions, serviceScopeFactory: null, httpContextAccessor: httpContextAccessor) : this(formOptions, serviceScopeFactory: null, httpContextAccessor: httpContextAccessor)
{ {
} }
/// <summary>
/// Initializes a new instance of the DefaultHttpContext class with options passed in.
/// <summary/>
/// <param name="formOptions">Options to set when instantianting the HTTP context object.</param>
/// <param name="serviceScopeFactory">Factory object used to create the service scope for the HTTP context.</param>
/// <param name="httpContextAccessor">Options to set when instantianting the Default HTTP context object.</param>
public HttpContextFactory(IOptions<FormOptions> formOptions, IServiceScopeFactory serviceScopeFactory, IHttpContextAccessor httpContextAccessor) public HttpContextFactory(IOptions<FormOptions> formOptions, IServiceScopeFactory serviceScopeFactory, IHttpContextAccessor httpContextAccessor)
{ {
if (formOptions == null) if (formOptions == null)
@ -47,6 +70,10 @@ namespace Microsoft.AspNetCore.Http
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
} }
/// <summary>
/// Initializes a new instance of the DefaultHttpContext class with options passed in.
/// <summary/>
/// <param name="featureCollection">Options to set when instantianting the Default HTTP context object.</param>
public HttpContext Create(IFeatureCollection featureCollection) public HttpContext Create(IFeatureCollection featureCollection)
{ {
if (featureCollection == null) if (featureCollection == null)
@ -66,6 +93,10 @@ namespace Microsoft.AspNetCore.Http
return httpContext; return httpContext;
} }
/// <summary>
/// Sets the HTTP context object to null for garbage collection.
/// <summary/>
/// <param name="httpContext">HTTP context to dispose.</param>
public void Dispose(HttpContext httpContext) public void Dispose(HttpContext httpContext)
{ {
if (_httpContextAccessor != null) if (_httpContextAccessor != null)