From 7c8d0f89f83119b7671152cfd6af68c2419517a6 Mon Sep 17 00:00:00 2001 From: Dairai Nyabando Date: Sat, 23 Nov 2019 18:27:12 -0500 Subject: [PATCH] Additional class and methods description changes including adding class references and inheriting docs #17349 --- src/Http/Http.Abstractions/src/HttpMethods.cs | 45 ++++++++-- src/Http/Http/src/DefaultHttpContext.cs | 82 +++++++------------ src/Http/Http/src/HttpContextAccessor.cs | 6 +- .../src/HttpsRedirectionMiddleware.cs | 6 +- 4 files changed, 70 insertions(+), 69 deletions(-) diff --git a/src/Http/Http.Abstractions/src/HttpMethods.cs b/src/Http/Http.Abstractions/src/HttpMethods.cs index 07a6a15a51..89f96a73fe 100644 --- a/src/Http/Http.Abstractions/src/HttpMethods.cs +++ b/src/Http/Http.Abstractions/src/HttpMethods.cs @@ -31,7 +31,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is CONNECT. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsConnect(string method) { return object.ReferenceEquals(Connect, method) || StringComparer.OrdinalIgnoreCase.Equals(Connect, method); @@ -40,7 +43,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is DELETE. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsDelete(string method) { return object.ReferenceEquals(Delete, method) || StringComparer.OrdinalIgnoreCase.Equals(Delete, method); @@ -49,7 +55,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is GET. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsGet(string method) { return object.ReferenceEquals(Get, method) || StringComparer.OrdinalIgnoreCase.Equals(Get, method); @@ -58,7 +67,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is HEAD. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsHead(string method) { return object.ReferenceEquals(Head, method) || StringComparer.OrdinalIgnoreCase.Equals(Head, method); @@ -67,7 +79,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is OPTIONS. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsOptions(string method) { return object.ReferenceEquals(Options, method) || StringComparer.OrdinalIgnoreCase.Equals(Options, method); @@ -76,7 +91,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is PATCH. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsPatch(string method) { return object.ReferenceEquals(Patch, method) || StringComparer.OrdinalIgnoreCase.Equals(Patch, method); @@ -85,7 +103,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is POST. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsPost(string method) { return object.ReferenceEquals(Post, method) || StringComparer.OrdinalIgnoreCase.Equals(Post, method); @@ -94,7 +115,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is PUT. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsPut(string method) { return object.ReferenceEquals(Put, method) || StringComparer.OrdinalIgnoreCase.Equals(Put, method); @@ -103,7 +127,10 @@ namespace Microsoft.AspNetCore.Http /// /// Returns a value that indicates if the HTTP request method is TRACE. /// - /// HTTP request method. + /// The HTTP request method. + /// + /// The System.Boolean. + /// public static bool IsTrace(string method) { return object.ReferenceEquals(Trace, method) || StringComparer.OrdinalIgnoreCase.Equals(Trace, method); diff --git a/src/Http/Http/src/DefaultHttpContext.cs b/src/Http/Http/src/DefaultHttpContext.cs index 70c1b0d29c..303dfbb3bc 100644 --- a/src/Http/Http/src/DefaultHttpContext.cs +++ b/src/Http/Http/src/DefaultHttpContext.cs @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Http private DefaultWebSocketManager _websockets; /// - /// Initializes a new instance of the DefaultHttpContext class. + /// Initializes a new instance of the class. /// public DefaultHttpContext() : this(new FeatureCollection()) @@ -47,9 +47,9 @@ namespace Microsoft.AspNetCore.Http } /// - /// Initializes a new instance of the DefaultHttpContext class with options passed in. + /// Initializes a new instance of the class with provided features. /// - /// Options to set when instantianting the Default HTTP context object. + /// Initial set of features for the . public DefaultHttpContext(IFeatureCollection features) { _features.Initalize(features); @@ -58,9 +58,12 @@ namespace Microsoft.AspNetCore.Http } /// - /// Initialize the current instant of the class with options passed in. + /// Reinitialize the current instant of the class with features passed in. /// - /// Options to initialize the Default HTTP context object. + /// + /// This method allows the consumer to re-use the for another request, rather than having to allocate a new instance. + /// + /// The new set of features for the . public void Initialize(IFeatureCollection features) { var revision = features.Revision; @@ -72,7 +75,7 @@ namespace Microsoft.AspNetCore.Http } /// - /// Uninitialize the child request, response, connection and websocket object features and reset the class instance features. + /// Uninitialize all the features in the . /// public void Uninitialize() { @@ -84,13 +87,19 @@ namespace Microsoft.AspNetCore.Http } /// - /// Gets or set the FormOptions for this instance. + /// Gets or set the for this instance. /// + /// + /// The Microsoft.AspNetCore.Http.Features.FormOptions. + /// public FormOptions FormOptions { get; set; } /// - /// Gets or sets the IServiceScopeFactory for this instance. + /// Gets or sets the for this instance. /// + /// + /// The Microsoft.Extensions.DependencyInjection.IServiceScopeFactory. + /// public IServiceScopeFactory ServiceScopeFactory { get; set; } private IItemsFeature ItemsFeature => @@ -115,43 +124,22 @@ namespace Microsoft.AspNetCore.Http private IHttpRequestIdentifierFeature RequestIdentifierFeature => _features.Fetch(ref _features.Cache.RequestIdentifier, _newHttpRequestIdentifierFeature); - /// - /// Returns the Features for this instance. If null, an ObjectDisposedException Exceptioon is thrown. - /// + /// public override IFeatureCollection Features => _features.Collection ?? ContextDisposed(); - /// - /// Returns the HttpRequest of this instance. - /// + /// public override HttpRequest Request => _request; - /// - /// Returns the HttpResponse of this instance. - /// + /// public override HttpResponse Response => _response; - /// - /// Returns the connection information of this instance. - /// - /// - /// If the Connection is null, a new DefaultConnectionInfo object is instantiated using the Features collection of this instance. - /// + /// public override ConnectionInfo Connection => _connection ?? (_connection = new DefaultConnectionInfo(Features)); - /// - /// Returns the Web Socket Manager of this instance. - /// - /// - /// If the Connection is null, a new DefaultWebSocketManager object is instantiated using the Features collection of this instance. - /// + /// public override WebSocketManager WebSockets => _websockets ?? (_websockets = new DefaultWebSocketManager(Features)); - /// - /// Gets or sets the claims principal of this instance. - /// - /// - /// If the ClaimsPrincipal object is null, a new ClaimsPrincipal object is instantiated. - /// + /// public override ClaimsPrincipal User { get @@ -167,48 +155,35 @@ namespace Microsoft.AspNetCore.Http set { HttpAuthenticationFeature.User = value; } } - /// - /// Gets or sets the item feature object(s) of this instance. - /// + /// public override IDictionary Items { get { return ItemsFeature.Items; } set { ItemsFeature.Items = value; } } - /// - /// Gets or sets the service provider feature object of this instance. - /// + /// public override IServiceProvider RequestServices { get { return ServiceProvidersFeature.RequestServices; } set { ServiceProvidersFeature.RequestServices = value; } } - /// - /// Gets or sets the cancellation token object of this instance. - /// + /// public override CancellationToken RequestAborted { get { return LifetimeFeature.RequestAborted; } set { LifetimeFeature.RequestAborted = value; } } - /// - /// Gets or sets the trace identifier of this instance. - /// + /// public override string TraceIdentifier { get { return RequestIdentifierFeature.TraceIdentifier; } set { RequestIdentifierFeature.TraceIdentifier = value; } } - /// - /// Gets or sets the session of this instance. - /// - /// - /// If session feature has not been set, an Invalid Operation Exception is thrown. - /// + /// public override ISession Session { get @@ -234,6 +209,7 @@ namespace Microsoft.AspNetCore.Http [EditorBrowsable(EditorBrowsableState.Never)] public HttpContext HttpContext => this; + /// public override void Abort() { LifetimeFeature.Abort(); diff --git a/src/Http/Http/src/HttpContextAccessor.cs b/src/Http/Http/src/HttpContextAccessor.cs index e910dcdfbb..deea3c266e 100644 --- a/src/Http/Http/src/HttpContextAccessor.cs +++ b/src/Http/Http/src/HttpContextAccessor.cs @@ -6,15 +6,13 @@ using System.Threading; namespace Microsoft.AspNetCore.Http { /// - /// Represents the properties and methods used to access the current HTTP context. + /// Provides an implementation of based on the current execution context. /// public class HttpContextAccessor : IHttpContextAccessor { private static AsyncLocal _httpContextCurrent = new AsyncLocal(); - /// - /// Gets or sets the HTTP context. - /// + /// public HttpContext HttpContext { get diff --git a/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs index 51925f22ff..9d0778bf6d 100644 --- a/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs +++ b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs @@ -14,7 +14,7 @@ using Microsoft.Net.Http.Headers; namespace Microsoft.AspNetCore.HttpsPolicy { /// - /// Provides functionality to redirect client requests to an address that uses the HTTPS protocol. + /// Middleware that redirects non-HTTPS requests to an HTTPS URL. /// public class HttpsRedirectionMiddleware { @@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.HttpsPolicy } /// - /// Initializes the HttpsRedirectionMiddleware. + /// Initializes . /// /// /// @@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.HttpsPolicy } /// - /// Invokes the HttpsRedirectionMiddleware + /// Invokes the HttpsRedirectionMiddleware. /// /// ///