10
10
11
11
namespace Microsoft . AspNetCore . Builder
12
12
{
13
+ /// <summary>
14
+ /// Provides extension methods for <see cref="IEndpointRouteBuilder"/> to add endpoints.
15
+ /// </summary>
13
16
public static class EndpointRouteBuilderExtensions
14
17
{
15
18
// Avoid creating a new array every call
@@ -19,6 +22,15 @@ public static class EndpointRouteBuilderExtensions
19
22
private static readonly string [ ] DeleteVerb = new [ ] { "DELETE" } ;
20
23
21
24
#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>
22
34
public static IEndpointConventionBuilder MapGet (
23
35
this IEndpointRouteBuilder builder ,
24
36
string pattern ,
@@ -28,6 +40,16 @@ public static IEndpointConventionBuilder MapGet(
28
40
return MapVerbs ( builder , pattern , displayName : null , requestDelegate , GetVerb , metadata ) ;
29
41
}
30
42
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>
31
53
public static IEndpointConventionBuilder MapGet (
32
54
this IEndpointRouteBuilder builder ,
33
55
string pattern ,
@@ -38,6 +60,15 @@ public static IEndpointConventionBuilder MapGet(
38
60
return MapVerbs ( builder , pattern , displayName , requestDelegate , GetVerb , metadata ) ;
39
61
}
40
62
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>
41
72
public static IEndpointConventionBuilder MapPost (
42
73
this IEndpointRouteBuilder builder ,
43
74
string pattern ,
@@ -47,6 +78,16 @@ public static IEndpointConventionBuilder MapPost(
47
78
return MapVerbs ( builder , pattern , displayName : null , requestDelegate , PostVerb , metadata ) ;
48
79
}
49
80
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>
50
91
public static IEndpointConventionBuilder MapPost (
51
92
this IEndpointRouteBuilder builder ,
52
93
string pattern ,
@@ -57,6 +98,15 @@ public static IEndpointConventionBuilder MapPost(
57
98
return MapVerbs ( builder , pattern , displayName , requestDelegate , PostVerb , metadata ) ;
58
99
}
59
100
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>
60
110
public static IEndpointConventionBuilder MapPut (
61
111
this IEndpointRouteBuilder builder ,
62
112
string pattern ,
@@ -66,6 +116,16 @@ public static IEndpointConventionBuilder MapPut(
66
116
return MapVerbs ( builder , pattern , displayName : null , requestDelegate , PutVerb , metadata ) ;
67
117
}
68
118
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>
69
129
public static IEndpointConventionBuilder MapPut (
70
130
this IEndpointRouteBuilder builder ,
71
131
string pattern ,
@@ -76,6 +136,15 @@ public static IEndpointConventionBuilder MapPut(
76
136
return MapVerbs ( builder , pattern , displayName , requestDelegate , PutVerb , metadata ) ;
77
137
}
78
138
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>
79
148
public static IEndpointConventionBuilder MapDelete (
80
149
this IEndpointRouteBuilder builder ,
81
150
string pattern ,
@@ -85,6 +154,16 @@ public static IEndpointConventionBuilder MapDelete(
85
154
return MapVerbs ( builder , pattern , displayName : null , requestDelegate , DeleteVerb , metadata ) ;
86
155
}
87
156
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>
88
167
public static IEndpointConventionBuilder MapDelete (
89
168
this IEndpointRouteBuilder builder ,
90
169
string pattern ,
@@ -95,6 +174,16 @@ public static IEndpointConventionBuilder MapDelete(
95
174
return MapVerbs ( builder , pattern , displayName , requestDelegate , DeleteVerb , metadata ) ;
96
175
}
97
176
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>
98
187
public static IEndpointConventionBuilder MapVerbs (
99
188
this IEndpointRouteBuilder builder ,
100
189
string pattern ,
@@ -105,6 +194,17 @@ public static IEndpointConventionBuilder MapVerbs(
105
194
return MapVerbs ( builder , pattern , displayName : null , requestDelegate , httpMethods , metadata ) ;
106
195
}
107
196
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>
108
208
public static IEndpointConventionBuilder MapVerbs (
109
209
this IEndpointRouteBuilder builder ,
110
210
string pattern ,
@@ -130,6 +230,15 @@ public static IEndpointConventionBuilder MapVerbs(
130
230
#endregion
131
231
132
232
#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>
133
242
public static IEndpointConventionBuilder Map (
134
243
this IEndpointRouteBuilder builder ,
135
244
string pattern ,
@@ -139,6 +248,16 @@ public static IEndpointConventionBuilder Map(
139
248
return Map ( builder , RoutePatternFactory . Parse ( pattern ) , pattern , requestDelegate , metadata ) ;
140
249
}
141
250
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>
142
261
public static IEndpointConventionBuilder Map (
143
262
this IEndpointRouteBuilder builder ,
144
263
string pattern ,
@@ -149,6 +268,15 @@ public static IEndpointConventionBuilder Map(
149
268
return Map ( builder , RoutePatternFactory . Parse ( pattern ) , displayName , requestDelegate , metadata ) ;
150
269
}
151
270
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>
152
280
public static IEndpointConventionBuilder Map (
153
281
this IEndpointRouteBuilder builder ,
154
282
RoutePattern pattern ,
@@ -158,6 +286,16 @@ public static IEndpointConventionBuilder Map(
158
286
return Map ( builder , pattern , pattern . RawText ?? pattern . DebuggerToString ( ) , requestDelegate , metadata ) ;
159
287
}
160
288
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>
161
299
public static IEndpointConventionBuilder Map (
162
300
this IEndpointRouteBuilder builder ,
163
301
RoutePattern pattern ,
0 commit comments