Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 7ed6a6c

Browse files
committed
Add doc-comments for main APIs
- Coherence-Signed#75
1 parent f00c7c6 commit 7ed6a6c

17 files changed

+253
-33
lines changed

src/Microsoft.AspNet.Http.Abstractions/Extensions/HttpResponseWritingExtensions.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public static class HttpResponseWritingExtensions
1616
/// <summary>
1717
/// Writes the given text to the response body. UTF-8 encoding will be used.
1818
/// </summary>
19-
/// <param name="response"></param>
20-
/// <param name="text"></param>
21-
/// <param name="cancellationToken"></param>
22-
/// <returns></returns>
19+
/// <param name="response">The <see cref="HttpResponse"/>.</param>
20+
/// <param name="text">The text to write to the response.</param>
21+
/// <param name="cancellationToken">Notifies when request operations should be cancelled.</param>
22+
/// <returns>A task that represents the completion of the write operation.</returns>
2323
public static Task WriteAsync(this HttpResponse response, string text, CancellationToken cancellationToken = default(CancellationToken))
2424
{
2525
if (response == null)
@@ -38,11 +38,11 @@ public static class HttpResponseWritingExtensions
3838
/// <summary>
3939
/// Writes the given text to the response body using the given encoding.
4040
/// </summary>
41-
/// <param name="response"></param>
42-
/// <param name="text"></param>
43-
/// <param name="encoding"></param>
44-
/// <param name="cancellationToken"></param>
45-
/// <returns></returns>
41+
/// <param name="response">The <see cref="HttpResponse"/>.</param>
42+
/// <param name="text">The text to write to the response.</param>
43+
/// <param name="encoding">The encoding to use.</param>
44+
/// <param name="cancellationToken">Notifies when request operations should be cancelled.</param>
45+
/// <returns>A task that represents the completion of the write operation.</returns>
4646
public static Task WriteAsync(this HttpResponse response, string text, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
4747
{
4848
if (response == null)

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapExtensions.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77

88
namespace Microsoft.AspNet.Builder
99
{
10+
/// <summary>
11+
/// Extension methods for the <see cref="MapMiddleware"/>.
12+
/// </summary>
1013
public static class MapExtensions
1114
{
1215
/// <summary>
13-
/// If the request path starts with the given pathMatch, execute the app configured via configuration parameter instead of
14-
/// continuing to the next component in the pipeline.
16+
/// Branches the request pipeline based on matches of the given request path. If the request path starts with
17+
/// the given path, the branch is executed.
1518
/// </summary>
16-
/// <param name="app"></param>
17-
/// <param name="pathMatch">The path to match</param>
18-
/// <param name="configuration">The branch to take for positive path matches</param>
19-
/// <returns></returns>
19+
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
20+
/// <param name="pathMatch">The request path to match.</param>
21+
/// <param name="configuration">The branch to take for positive path matches.</param>
22+
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
2023
public static IApplicationBuilder Map(this IApplicationBuilder app, PathString pathMatch, Action<IApplicationBuilder> configuration)
2124
{
2225
if (app == null)
@@ -39,7 +42,7 @@ public static IApplicationBuilder Map(this IApplicationBuilder app, PathString p
3942
configuration(branchBuilder);
4043
var branch = branchBuilder.Build();
4144

42-
var options = new MapOptions()
45+
var options = new MapOptions
4346
{
4447
Branch = branch,
4548
PathMatch = pathMatch,

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapMiddleware.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77

88
namespace Microsoft.AspNet.Builder.Extensions
99
{
10+
/// <summary>
11+
/// Respresents a middleware that maps a request path to a sub-request pipeline.
12+
/// </summary>
1013
public class MapMiddleware
1114
{
1215
private readonly RequestDelegate _next;
1316
private readonly MapOptions _options;
1417

18+
/// <summary>
19+
/// Creates a new instace of <see cref="MapMiddleware"/>.
20+
/// </summary>
21+
/// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
22+
/// <param name="options">The middleware options.</param>
1523
public MapMiddleware(RequestDelegate next, MapOptions options)
1624
{
1725
if (next == null)
@@ -28,6 +36,11 @@ public MapMiddleware(RequestDelegate next, MapOptions options)
2836
_options = options;
2937
}
3038

39+
/// <summary>
40+
/// Executes the middleware.
41+
/// </summary>
42+
/// <param name="context">The <see cref="HttpContext"/> for the current request.</param>
43+
/// <returns>A task that represents the execution of this middleware.</returns>
3144
public async Task Invoke(HttpContext context)
3245
{
3346
if (context == null)

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
namespace Microsoft.AspNet.Builder.Extensions
77
{
88
/// <summary>
9-
/// Options for the Map middleware
9+
/// Options for the <see cref="MapMiddleware"/>.
1010
/// </summary>
1111
public class MapOptions
1212
{
1313
/// <summary>
14-
/// The path to match
14+
/// The path to match.
1515
/// </summary>
1616
public PathString PathMatch { get; set; }
1717

1818
/// <summary>
19-
/// The branch taken for a positive match
19+
/// The branch taken for a positive match.
2020
/// </summary>
2121
public RequestDelegate Branch { get; set; }
2222
}

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapWhenExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Builder
1111
using Predicate = Func<HttpContext, bool>;
1212

1313
/// <summary>
14-
/// Extension methods for the MapWhenMiddleware
14+
/// Extension methods for the <see cref="MapWhenMiddleware"/>.
1515
/// </summary>
1616
public static class MapWhenExtensions
1717
{

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapWhenMiddleware.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77

88
namespace Microsoft.AspNet.Builder.Extensions
99
{
10+
/// <summary>
11+
/// Respresents a middleware that runs a sub-request pipeline when a given predicate is matched.
12+
/// </summary>
1013
public class MapWhenMiddleware
1114
{
1215
private readonly RequestDelegate _next;
1316
private readonly MapWhenOptions _options;
1417

18+
/// <summary>
19+
/// Creates a new instance of <see cref="MapWhenMiddleware"/>.
20+
/// </summary>
21+
/// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
22+
/// <param name="options">The middleware options.</param>
1523
public MapWhenMiddleware(RequestDelegate next, MapWhenOptions options)
1624
{
1725
if (next == null)
@@ -28,6 +36,11 @@ public MapWhenMiddleware(RequestDelegate next, MapWhenOptions options)
2836
_options = options;
2937
}
3038

39+
/// <summary>
40+
/// Executes the middleware.
41+
/// </summary>
42+
/// <param name="context">The <see cref="HttpContext"/> for the current request.</param>
43+
/// <returns>A task that represents the execution of this middleware.</returns>
3144
public async Task Invoke(HttpContext context)
3245
{
3346
if (context == null)

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapWhenOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
namespace Microsoft.AspNet.Builder.Extensions
88
{
99
/// <summary>
10-
/// Options for the MapWhen middleware
10+
/// Options for the <see cref="MapWhenMiddleware"/>.
1111
/// </summary>
1212
public class MapWhenOptions
1313
{
1414
private Func<HttpContext, bool> _predicate;
1515

1616
/// <summary>
17-
/// The user callback that determines if the branch should be taken
17+
/// The user callback that determines if the branch should be taken.
1818
/// </summary>
1919
public Func<HttpContext, bool> Predicate
2020
{
@@ -34,7 +34,7 @@ public Func<HttpContext, bool> Predicate
3434
}
3535

3636
/// <summary>
37-
/// The branch taken for a positive match
37+
/// The branch taken for a positive match.
3838
/// </summary>
3939
public RequestDelegate Branch { get; set; }
4040
}

src/Microsoft.AspNet.Http.Abstractions/Extensions/RunExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@
55

66
namespace Microsoft.AspNet.Builder
77
{
8+
/// <summary>
9+
/// Extension methods for adding terminal middleware.
10+
/// </summary>
811
public static class RunExtensions
912
{
13+
/// <summary>
14+
/// Adds a terminal middleware delagate to the application's request pipeline.
15+
/// </summary>
16+
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
17+
/// <param name="handler">A delegate that handles the request.</param>
1018
public static void Run(this IApplicationBuilder app, RequestDelegate handler)
1119
{
1220
if (app == null)

src/Microsoft.AspNet.Http.Abstractions/Extensions/UseExtensions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77

88
namespace Microsoft.AspNet.Builder
99
{
10+
/// <summary>
11+
/// Extension methods for adding middleware.
12+
/// </summary>
1013
public static class UseExtensions
1114
{
1215
/// <summary>
13-
/// Use middleware defined in-line.
16+
/// Adds a middleware delagate defined in-line to the application's request pipeline.
1417
/// </summary>
15-
/// <param name="app"></param>
18+
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
1619
/// <param name="middleware">A function that handles the request or calls the given next function.</param>
17-
/// <returns></returns>
20+
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
1821
public static IApplicationBuilder Use(this IApplicationBuilder app, Func<HttpContext, Func<Task>, Task> middleware)
1922
{
2023
return app.Use(next =>

src/Microsoft.AspNet.Http.Abstractions/Extensions/UseMiddlewareExtensions.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,36 @@
1111

1212
namespace Microsoft.AspNet.Builder
1313
{
14+
/// <summary>
15+
/// Extension methods for adding typed middlware.
16+
/// </summary>
1417
public static class UseMiddlewareExtensions
1518
{
1619
const string InvokeMethodName = "Invoke";
17-
public static IApplicationBuilder UseMiddleware<T>(this IApplicationBuilder builder, params object[] args)
20+
21+
/// <summary>
22+
/// Adds a middleware type to the application's request pipeline.
23+
/// </summary>
24+
/// <typeparam name="TMiddleware">The middleware type.</typeparam>
25+
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
26+
/// <param name="args">The arguments to pass to the middleware type instance's constructor.</param>
27+
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
28+
public static IApplicationBuilder UseMiddleware<TMiddleware>(this IApplicationBuilder app, params object[] args)
1829
{
19-
return builder.UseMiddleware(typeof(T), args);
30+
return app.UseMiddleware(typeof(TMiddleware), args);
2031
}
2132

22-
public static IApplicationBuilder UseMiddleware(this IApplicationBuilder builder, Type middleware, params object[] args)
33+
/// <summary>
34+
/// Adds a middleware type to the application's request pipeline.
35+
/// </summary>
36+
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
37+
/// <param name="middleware">The middleware type.</param>
38+
/// <param name="args">The arguments to pass to the middleware type instance's constructor.</param>
39+
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
40+
public static IApplicationBuilder UseMiddleware(this IApplicationBuilder app, Type middleware, params object[] args)
2341
{
24-
var applicationServices = builder.ApplicationServices;
25-
return builder.Use(next =>
42+
var applicationServices = app.ApplicationServices;
43+
return app.Use(next =>
2644
{
2745
var methods = middleware.GetMethods(BindingFlags.Instance | BindingFlags.Public);
2846
var invokeMethods = methods.Where(m => string.Equals(m.Name, InvokeMethodName, StringComparison.Ordinal)).ToArray();
@@ -48,7 +66,7 @@ public static IApplicationBuilder UseMiddleware(this IApplicationBuilder builder
4866
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoParameters(InvokeMethodName,nameof(HttpContext)));
4967
}
5068

51-
var instance = ActivatorUtilities.CreateInstance(builder.ApplicationServices, middleware, new[] { next }.Concat(args).ToArray());
69+
var instance = ActivatorUtilities.CreateInstance(app.ApplicationServices, middleware, new[] { next }.Concat(args).ToArray());
5270
if (parameters.Length == 1)
5371
{
5472
return (RequestDelegate)methodinfo.CreateDelegate(typeof(RequestDelegate), instance);

src/Microsoft.AspNet.Http.Abstractions/HttpContext.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,80 @@
1010

1111
namespace Microsoft.AspNet.Http
1212
{
13+
/// <summary>
14+
/// Encapsulates all HTTP-specific information about an individual HTTP request.
15+
/// </summary>
1316
public abstract class HttpContext
1417
{
18+
/// <summary>
19+
/// Gets the collection of HTTP features provided by the server and middleware available on this request.
20+
/// </summary>
1521
public abstract IFeatureCollection Features { get; }
1622

23+
/// <summary>
24+
/// Gets the <see cref="HttpRequest"/> object for this request.
25+
/// </summary>
1726
public abstract HttpRequest Request { get; }
1827

28+
/// <summary>
29+
/// Gets the <see cref="HttpResponse"/> object for this request.
30+
/// </summary>
1931
public abstract HttpResponse Response { get; }
2032

33+
/// <summary>
34+
/// Gets information about the underlying connection for this request.
35+
/// </summary>
2136
public abstract ConnectionInfo Connection { get; }
2237

38+
/// <summary>
39+
/// Gets an object that manages the establishment of WebSocket connections for this request.
40+
/// </summary>
2341
public abstract WebSocketManager WebSockets { get; }
2442

43+
/// <summary>
44+
/// Gets an object that facilitates authentication for this request.
45+
/// </summary>
2546
public abstract AuthenticationManager Authentication { get; }
2647

48+
/// <summary>
49+
/// Gets or sets the the user for this request.
50+
/// </summary>
2751
public abstract ClaimsPrincipal User { get; set; }
2852

53+
/// <summary>
54+
/// Gets or sets a key/value collection that can be used to share data within the scope of this request.
55+
/// </summary>
2956
public abstract IDictionary<object, object> Items { get; set; }
3057

58+
/// <summary>
59+
/// Gets or sets the <see cref="IServiceProvider"/> that provides access to the application's service container.
60+
/// </summary>
3161
public abstract IServiceProvider ApplicationServices { get; set; }
3262

63+
/// <summary>
64+
/// Gets or sets the <see cref="IServiceProvider"/> that provides access to the request's service container.
65+
/// </summary>
3366
public abstract IServiceProvider RequestServices { get; set; }
3467

68+
/// <summary>
69+
/// Notifies when the connection underlying this request is aborted and thus request operations should be
70+
/// cancelled.
71+
/// </summary>
3572
public abstract CancellationToken RequestAborted { get; set; }
3673

74+
/// <summary>
75+
/// Gets or sets a unique identifier to represent this request in trace logs.
76+
/// </summary>
3777
public abstract string TraceIdentifier { get; set; }
3878

79+
/// <summary>
80+
/// Gets or sets the object used to manage user session data for this request.
81+
/// </summary>
3982
public abstract ISession Session { get; set; }
4083

84+
/// <summary>
85+
/// Aborts the connection underlying this request.
86+
/// </summary>
4187
public abstract void Abort();
4288
}
4389
}

src/Microsoft.AspNet.Http.Abstractions/HttpRequest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77

88
namespace Microsoft.AspNet.Http
99
{
10+
/// <summary>
11+
/// Represents the incoming side of an individual HTTP request.
12+
/// </summary>
1013
public abstract class HttpRequest
1114
{
15+
/// <summary>
16+
/// Gets the <see cref="HttpContext"/> this request;
17+
/// </summary>
1218
public abstract HttpContext HttpContext { get; }
1319

1420
/// <summary>

0 commit comments

Comments
 (0)