Skip to content

Commit 133a7e0

Browse files
authored
Add XML docs to endpoint route builder and extensions (#6700)
1 parent cc89207 commit 133a7e0

File tree

2 files changed

+154
-2
lines changed

2 files changed

+154
-2
lines changed

src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace Microsoft.AspNetCore.Builder
1212
{
13+
/// <summary>
14+
/// Provides extension methods for <see cref="IEndpointRouteBuilder"/> to add endpoints.
15+
/// </summary>
1316
public static class EndpointRouteBuilderExtensions
1417
{
1518
// Avoid creating a new array every call
@@ -19,6 +22,15 @@ public static class EndpointRouteBuilderExtensions
1922
private static readonly string[] DeleteVerb = new[] { "DELETE" };
2023

2124
#region MapVerbs
25+
/// <summary>
26+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP GET requests
27+
/// for the specified pattern.
28+
/// </summary>
29+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
30+
/// <param name="pattern">The route pattern.</param>
31+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
32+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
33+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
2234
public static IEndpointConventionBuilder MapGet(
2335
this IEndpointRouteBuilder builder,
2436
string pattern,
@@ -28,6 +40,16 @@ public static IEndpointConventionBuilder MapGet(
2840
return MapVerbs(builder, pattern, displayName: null, requestDelegate, GetVerb, metadata);
2941
}
3042

43+
/// <summary>
44+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP GET requests
45+
/// for the specified pattern.
46+
/// </summary>
47+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
48+
/// <param name="pattern">The route pattern.</param>
49+
/// <param name="displayName">The display name for the endpoint.</param>
50+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
51+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
52+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
3153
public static IEndpointConventionBuilder MapGet(
3254
this IEndpointRouteBuilder builder,
3355
string pattern,
@@ -38,6 +60,15 @@ public static IEndpointConventionBuilder MapGet(
3860
return MapVerbs(builder, pattern, displayName, requestDelegate, GetVerb, metadata);
3961
}
4062

63+
/// <summary>
64+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP POST requests
65+
/// for the specified pattern.
66+
/// </summary>
67+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
68+
/// <param name="pattern">The route pattern.</param>
69+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
70+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
71+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
4172
public static IEndpointConventionBuilder MapPost(
4273
this IEndpointRouteBuilder builder,
4374
string pattern,
@@ -47,6 +78,16 @@ public static IEndpointConventionBuilder MapPost(
4778
return MapVerbs(builder, pattern, displayName: null, requestDelegate, PostVerb, metadata);
4879
}
4980

81+
/// <summary>
82+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP POST requests
83+
/// for the specified pattern.
84+
/// </summary>
85+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
86+
/// <param name="pattern">The route pattern.</param>
87+
/// <param name="displayName">The display name for the endpoint.</param>
88+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
89+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
90+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
5091
public static IEndpointConventionBuilder MapPost(
5192
this IEndpointRouteBuilder builder,
5293
string pattern,
@@ -57,6 +98,15 @@ public static IEndpointConventionBuilder MapPost(
5798
return MapVerbs(builder, pattern, displayName, requestDelegate, PostVerb, metadata);
5899
}
59100

101+
/// <summary>
102+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP PUT requests
103+
/// for the specified pattern.
104+
/// </summary>
105+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
106+
/// <param name="pattern">The route pattern.</param>
107+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
108+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
109+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
60110
public static IEndpointConventionBuilder MapPut(
61111
this IEndpointRouteBuilder builder,
62112
string pattern,
@@ -66,6 +116,16 @@ public static IEndpointConventionBuilder MapPut(
66116
return MapVerbs(builder, pattern, displayName: null, requestDelegate, PutVerb, metadata);
67117
}
68118

119+
/// <summary>
120+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP PUT requests
121+
/// for the specified pattern.
122+
/// </summary>
123+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
124+
/// <param name="pattern">The route pattern.</param>
125+
/// <param name="displayName">The display name for the endpoint.</param>
126+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
127+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
128+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
69129
public static IEndpointConventionBuilder MapPut(
70130
this IEndpointRouteBuilder builder,
71131
string pattern,
@@ -76,6 +136,15 @@ public static IEndpointConventionBuilder MapPut(
76136
return MapVerbs(builder, pattern, displayName, requestDelegate, PutVerb, metadata);
77137
}
78138

139+
/// <summary>
140+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP DELETE requests
141+
/// for the specified pattern.
142+
/// </summary>
143+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
144+
/// <param name="pattern">The route pattern.</param>
145+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
146+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
147+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
79148
public static IEndpointConventionBuilder MapDelete(
80149
this IEndpointRouteBuilder builder,
81150
string pattern,
@@ -85,6 +154,16 @@ public static IEndpointConventionBuilder MapDelete(
85154
return MapVerbs(builder, pattern, displayName: null, requestDelegate, DeleteVerb, metadata);
86155
}
87156

157+
/// <summary>
158+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP DELETE requests
159+
/// for the specified pattern.
160+
/// </summary>
161+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
162+
/// <param name="pattern">The route pattern.</param>
163+
/// <param name="displayName">The display name for the endpoint.</param>
164+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
165+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
166+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
88167
public static IEndpointConventionBuilder MapDelete(
89168
this IEndpointRouteBuilder builder,
90169
string pattern,
@@ -95,6 +174,16 @@ public static IEndpointConventionBuilder MapDelete(
95174
return MapVerbs(builder, pattern, displayName, requestDelegate, DeleteVerb, metadata);
96175
}
97176

177+
/// <summary>
178+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
179+
/// for the specified HTTP methods and pattern.
180+
/// </summary>
181+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
182+
/// <param name="pattern">The route pattern.</param>
183+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
184+
/// <param name="httpMethods">HTTP methods that the endpoint will match.</param>
185+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
186+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
98187
public static IEndpointConventionBuilder MapVerbs(
99188
this IEndpointRouteBuilder builder,
100189
string pattern,
@@ -105,6 +194,17 @@ public static IEndpointConventionBuilder MapVerbs(
105194
return MapVerbs(builder, pattern, displayName: null, requestDelegate, httpMethods, metadata);
106195
}
107196

197+
/// <summary>
198+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
199+
/// for the specified HTTP methods and pattern.
200+
/// </summary>
201+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
202+
/// <param name="pattern">The route pattern.</param>
203+
/// <param name="displayName">The display name for the endpoint.</param>
204+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
205+
/// <param name="httpMethods">HTTP methods that the endpoint will match.</param>
206+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
207+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
108208
public static IEndpointConventionBuilder MapVerbs(
109209
this IEndpointRouteBuilder builder,
110210
string pattern,
@@ -130,6 +230,15 @@ public static IEndpointConventionBuilder MapVerbs(
130230
#endregion
131231

132232
#region Map
233+
/// <summary>
234+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
235+
/// for the specified pattern.
236+
/// </summary>
237+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
238+
/// <param name="pattern">The route pattern.</param>
239+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
240+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
241+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
133242
public static IEndpointConventionBuilder Map(
134243
this IEndpointRouteBuilder builder,
135244
string pattern,
@@ -139,6 +248,16 @@ public static IEndpointConventionBuilder Map(
139248
return Map(builder, RoutePatternFactory.Parse(pattern), pattern, requestDelegate, metadata);
140249
}
141250

251+
/// <summary>
252+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
253+
/// for the specified pattern.
254+
/// </summary>
255+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
256+
/// <param name="pattern">The route pattern.</param>
257+
/// <param name="displayName">The display name for the endpoint.</param>
258+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
259+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
260+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
142261
public static IEndpointConventionBuilder Map(
143262
this IEndpointRouteBuilder builder,
144263
string pattern,
@@ -149,6 +268,15 @@ public static IEndpointConventionBuilder Map(
149268
return Map(builder, RoutePatternFactory.Parse(pattern), displayName, requestDelegate, metadata);
150269
}
151270

271+
/// <summary>
272+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
273+
/// for the specified pattern.
274+
/// </summary>
275+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
276+
/// <param name="pattern">The route pattern.</param>
277+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
278+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
279+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
152280
public static IEndpointConventionBuilder Map(
153281
this IEndpointRouteBuilder builder,
154282
RoutePattern pattern,
@@ -158,6 +286,16 @@ public static IEndpointConventionBuilder Map(
158286
return Map(builder, pattern, pattern.RawText ?? pattern.DebuggerToString(), requestDelegate, metadata);
159287
}
160288

289+
/// <summary>
290+
/// Adds a <see cref="RouteEndpoint"/> to the <see cref="IEndpointRouteBuilder"/> that matches HTTP requests
291+
/// for the specified pattern.
292+
/// </summary>
293+
/// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
294+
/// <param name="pattern">The route pattern.</param>
295+
/// <param name="displayName">The display name for the endpoint.</param>
296+
/// <param name="requestDelegate">The delegate executed when the endpoint is matched.</param>
297+
/// <param name="metadata">Metadata that is added to the endpoint.</param>
298+
/// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
161299
public static IEndpointConventionBuilder Map(
162300
this IEndpointRouteBuilder builder,
163301
RoutePattern pattern,
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -7,12 +7,26 @@
77

88
namespace Microsoft.AspNetCore.Routing
99
{
10+
/// <summary>
11+
/// Defines a contract for a route builder in an application. A route builder specifies the routes for
12+
/// an application.
13+
/// </summary>
1014
public interface IEndpointRouteBuilder
1115
{
16+
/// <summary>
17+
/// Creates a new <see cref="IApplicationBuilder"/>.
18+
/// </summary>
19+
/// <returns>The new <see cref="IApplicationBuilder"/>.</returns>
1220
IApplicationBuilder CreateApplicationBuilder();
1321

22+
/// <summary>
23+
/// Gets the sets the <see cref="IServiceProvider"/> used to resolve services for routes.
24+
/// </summary>
1425
IServiceProvider ServiceProvider { get; }
1526

27+
/// <summary>
28+
/// Gets the endpoint data sources configured in the builder.
29+
/// </summary>
1630
ICollection<EndpointDataSource> DataSources { get; }
1731
}
18-
}
32+
}

0 commit comments

Comments
 (0)