Skip to content

Commit 4b46146

Browse files
committed
Change template -> pattern for MVC
1 parent e78a652 commit 4b46146

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

src/Http/Routing/test/testassets/RoutingSandbox/HelloExtension/EndpointRouteBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Builder
1313
{
1414
public static class EndpointRouteBuilderExtensions
1515
{
16-
public static IEndpointConventionBuilder MapHello(this IEndpointRouteBuilder routes, string template, string greeter)
16+
public static IEndpointConventionBuilder MapHello(this IEndpointRouteBuilder routes, string pattern, string greeter)
1717
{
1818
if (routes == null)
1919
{
@@ -25,7 +25,7 @@ public static IEndpointConventionBuilder MapHello(this IEndpointRouteBuilder rou
2525
.Build();
2626

2727
return routes.Map(
28-
template,
28+
pattern,
2929
"Hello " + greeter,
3030
pipeline);
3131
}

src/Mvc/Mvc.Core/src/Builder/ControllerEndpointRouteBuilderExtensions.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ public static IEndpointConventionBuilder MapDefaultControllerRoute(this IEndpoin
6262

6363
/// <summary>
6464
/// Adds endpoints for controller actions to the <see cref="IEndpointRouteBuilder"/> and specifies a route
65-
/// with the given <paramref name="name"/>, <paramref name="template"/>,
65+
/// with the given <paramref name="name"/>, <paramref name="pattern"/>,
6666
/// <paramref name="defaults"/>, <paramref name="constraints"/>, and <paramref name="dataTokens"/>.
6767
/// </summary>
6868
/// <param name="routes">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
6969
/// <param name="name">The name of the route.</param>
70-
/// <param name="template">The URL pattern of the route.</param>
70+
/// <param name="pattern">The URL pattern of the route.</param>
7171
/// <param name="defaults">
7272
/// An object that contains default values for route parameters. The object's properties represent the
7373
/// names and values of the default values.
@@ -83,7 +83,7 @@ public static IEndpointConventionBuilder MapDefaultControllerRoute(this IEndpoin
8383
public static void MapControllerRoute(
8484
this IEndpointRouteBuilder routes,
8585
string name,
86-
string template,
86+
string pattern,
8787
object defaults = null,
8888
object constraints = null,
8989
object dataTokens = null)
@@ -98,21 +98,21 @@ public static void MapControllerRoute(
9898
var dataSource = GetOrCreateDataSource(routes);
9999
dataSource.AddRoute(new ConventionalRouteEntry(
100100
name,
101-
template,
101+
pattern,
102102
new RouteValueDictionary(defaults),
103103
new RouteValueDictionary(constraints),
104104
new RouteValueDictionary(dataTokens)));
105105
}
106106

107107
/// <summary>
108108
/// Adds endpoints for controller actions to the <see cref="IEndpointRouteBuilder"/> and specifies a route
109-
/// with the given <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="template"/>,
109+
/// with the given <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="pattern"/>,
110110
/// <paramref name="defaults"/>, <paramref name="constraints"/>, and <paramref name="dataTokens"/>.
111111
/// </summary>
112112
/// <param name="routes">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
113113
/// <param name="name">The name of the route.</param>
114114
/// <param name="areaName">The area name.</param>
115-
/// <param name="template">The URL pattern of the route.</param>
115+
/// <param name="pattern">The URL pattern of the route.</param>
116116
/// <param name="defaults">
117117
/// An object that contains default values for route parameters. The object's properties represent the
118118
/// names and values of the default values.
@@ -129,7 +129,7 @@ public static void MapAreaControllerRoute(
129129
this IEndpointRouteBuilder routes,
130130
string name,
131131
string areaName,
132-
string template,
132+
string pattern,
133133
object defaults = null,
134134
object constraints = null,
135135
object dataTokens = null)
@@ -150,7 +150,7 @@ public static void MapAreaControllerRoute(
150150
var constraintsDictionary = new RouteValueDictionary(constraints);
151151
constraintsDictionary["area"] = constraintsDictionary["area"] ?? new StringRouteConstraint(areaName);
152152

153-
routes.MapControllerRoute(name, template, defaultsDictionary, constraintsDictionary, dataTokens);
153+
routes.MapControllerRoute(name, pattern, defaultsDictionary, constraintsDictionary, dataTokens);
154154
}
155155

156156
/// <summary>
@@ -175,7 +175,7 @@ public static void MapAreaControllerRoute(
175175
/// <para>
176176
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string)"/> does not re-execute routing, and will
177177
/// not generate route values based on routes defined elsewhere. When using this overload, the <c>path</c> route value
178-
/// will be available.
178+
/// will be available.
179179
/// </para>
180180
/// <para>
181181
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string)"/> does not attempt to disambiguate between
@@ -184,8 +184,8 @@ public static void MapAreaControllerRoute(
184184
/// </para>
185185
/// </remarks>
186186
public static void MapFallbackToController(
187-
this IEndpointRouteBuilder routes,
188-
string action,
187+
this IEndpointRouteBuilder routes,
188+
string action,
189189
string controller)
190190
{
191191
if (routes == null)
@@ -209,7 +209,7 @@ public static void MapFallbackToController(
209209
GetOrCreateDataSource(routes);
210210

211211
// Maps a fallback endpoint with an empty delegate. This is OK because
212-
// we don't expect the delegate to run.
212+
// we don't expect the delegate to run.
213213
routes.MapFallback(context => Task.CompletedTask).Add(b =>
214214
{
215215
// MVC registers a policy that looks for this metadata.
@@ -228,8 +228,8 @@ public static void MapFallbackToController(
228228
/// <param name="controller">The controller name.</param>
229229
/// <remarks>
230230
/// <para>
231-
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string, string)"/> is intended to handle cases
232-
/// where URL path of the request does not contain a file name, and no other endpoint has matched. This is convenient
231+
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string, string)"/> is intended to handle cases
232+
/// where URL path of the request does not contain a file name, and no other endpoint has matched. This is convenient
233233
/// for routing requests for dynamic content to a SPA framework, while also allowing requests for non-existent files to
234234
/// result in an HTTP 404.
235235
/// </para>
@@ -242,8 +242,8 @@ public static void MapFallbackToController(
242242
/// </para>
243243
/// <para>
244244
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string, string)"/> does not re-execute routing, and will
245-
/// not generate route values based on routes defined elsewhere. When using this overload, the route values provided by matching
246-
/// <paramref name="pattern"/> will be available.
245+
/// not generate route values based on routes defined elsewhere. When using this overload, the route values provided by matching
246+
/// <paramref name="pattern"/> will be available.
247247
/// </para>
248248
/// <para>
249249
/// <see cref="MapFallbackToController(IEndpointRouteBuilder, string, string, string)"/> does not attempt to disambiguate between
@@ -283,7 +283,7 @@ public static void MapFallbackToController(
283283
GetOrCreateDataSource(routes);
284284

285285
// Maps a fallback endpoint with an empty delegate. This is OK because
286-
// we don't expect the delegate to run.
286+
// we don't expect the delegate to run.
287287
routes.MapFallback(pattern, context => Task.CompletedTask).Add(b =>
288288
{
289289
// MVC registers a policy that looks for this metadata.
@@ -314,7 +314,7 @@ public static void MapFallbackToController(
314314
/// <para>
315315
/// <see cref="MapFallbackToAreaController(IEndpointRouteBuilder, string, string, string)"/> does not re-execute routing, and will
316316
/// not generate route values based on routes defined elsewhere. When using this overload, the <c>path</c> route value
317-
/// will be available.
317+
/// will be available.
318318
/// </para>
319319
/// <para>
320320
/// <see cref="MapFallbackToAreaController(IEndpointRouteBuilder, string, string, string)"/> does not attempt to disambiguate between
@@ -349,7 +349,7 @@ public static void MapFallbackToAreaController(
349349
GetOrCreateDataSource(routes);
350350

351351
// Maps a fallback endpoint with an empty delegate. This is OK because
352-
// we don't expect the delegate to run.
352+
// we don't expect the delegate to run.
353353
routes.MapFallback(context => Task.CompletedTask).Add(b =>
354354
{
355355
// MVC registers a policy that looks for this metadata.
@@ -369,8 +369,8 @@ public static void MapFallbackToAreaController(
369369
/// <param name="area">The area name.</param>
370370
/// <remarks>
371371
/// <para>
372-
/// <see cref="MapFallbackToAreaController(IEndpointRouteBuilder, string, string, string, string)"/> is intended to handle
373-
/// cases where URL path of the request does not contain a file name, and no other endpoint has matched. This is
372+
/// <see cref="MapFallbackToAreaController(IEndpointRouteBuilder, string, string, string, string)"/> is intended to handle
373+
/// cases where URL path of the request does not contain a file name, and no other endpoint has matched. This is
374374
/// convenient for routing requests for dynamic content to a SPA framework, while also allowing requests for non-existent files to
375375
/// result in an HTTP 404.
376376
/// </para>
@@ -383,7 +383,7 @@ public static void MapFallbackToAreaController(
383383
/// </para>
384384
/// <para>
385385
/// <see cref="MapFallbackToAreaController(IEndpointRouteBuilder, string, string, string, string)"/> does not re-execute routing, and will
386-
/// not generate route values based on routes defined elsewhere. When using this overload, the route values provided by matching
386+
/// not generate route values based on routes defined elsewhere. When using this overload, the route values provided by matching
387387
/// <paramref name="pattern"/> will be available.
388388
/// </para>
389389
/// <para>
@@ -425,7 +425,7 @@ public static void MapFallbackToAreaController(
425425
GetOrCreateDataSource(routes);
426426

427427
// Maps a fallback endpoint with an empty delegate. This is OK because
428-
// we don't expect the delegate to run.
428+
// we don't expect the delegate to run.
429429
routes.MapFallback(pattern, context => Task.CompletedTask).Add(b =>
430430
{
431431
// MVC registers a policy that looks for this metadata.

src/Mvc/Mvc.Core/src/Builder/MvcAreaRouteBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static IRouteBuilder MapAreaRoute(
5959

6060
/// <summary>
6161
/// Adds a route to the <see cref="IRouteBuilder"/> with the given MVC area with the specified
62-
/// <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="template"/>,
62+
/// <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="template"/>,
6363
/// <paramref name="defaults"/>, and <paramref name="constraints"/>.
6464
/// </summary>
6565
/// <param name="routeBuilder">The <see cref="IRouteBuilder"/> to add the route to.</param>
@@ -89,7 +89,7 @@ public static IRouteBuilder MapAreaRoute(
8989

9090
/// <summary>
9191
/// Adds a route to the <see cref="IRouteBuilder"/> with the given MVC area with the specified
92-
/// <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="template"/>,
92+
/// <paramref name="name"/>, <paramref name="areaName"/>, <paramref name="template"/>,
9393
/// <paramref name="defaults"/>, <paramref name="constraints"/>, and <paramref name="dataTokens"/>.
9494
/// </summary>
9595
/// <param name="routeBuilder">The <see cref="IRouteBuilder"/> to add the route to.</param>

src/Mvc/samples/MvcSandbox/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public void Configure(IApplicationBuilder app)
4343

4444
builder.MapControllerRoute(
4545
name: "default",
46-
template: "{controller=Home}/{action=Index}/{id?}");
46+
pattern: "{controller=Home}/{action=Index}/{id?}");
4747

4848
builder.MapControllerRoute(
4949
name: "transform",
50-
template: "Transform/{controller:slugify=Home}/{action:slugify=Index}/{id?}",
50+
pattern: "Transform/{controller:slugify=Home}/{action:slugify=Index}/{id?}",
5151
defaults: null,
5252
constraints: new { controller = "Home" });
5353

src/Mvc/test/WebSites/ApplicationModelWebSite/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public void Configure(IApplicationBuilder app)
2929
{
3030
app.UseRouting(routes =>
3131
{
32-
routes.MapControllerRoute(name: "areaRoute", template: "{area:exists}/{controller=Home}/{action=Index}");
33-
routes.MapControllerRoute(name: "default", template: "{controller}/{action}/{id?}");
32+
routes.MapControllerRoute(name: "areaRoute", pattern: "{area:exists}/{controller=Home}/{action=Index}");
33+
routes.MapControllerRoute(name: "default", pattern: "{controller}/{action}/{id?}");
3434

3535
routes.MapRazorPages();
3636
});

src/Mvc/test/WebSites/BasicWebSite/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public void Configure(IApplicationBuilder app)
3939
{
4040
routes.MapControllerRoute(
4141
name: "ActionAsMethod",
42-
template: "{controller}/{action}",
42+
pattern: "{controller}/{action}",
4343
defaults: new { controller = "Home", action = "Index" });
4444

4545
routes.MapControllerRoute(
46-
name: "PageRoute",
47-
template: "{controller}/{action}/{page}");
46+
name: "PageRoute",
47+
pattern: "{controller}/{action}/{page}");
4848
});
4949
}
5050
}

src/Mvc/test/WebSites/HtmlGenerationWebSite/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ public virtual void Configure(IApplicationBuilder app)
3434
{
3535
routes.MapControllerRoute(
3636
name: "areaRoute",
37-
template: "{area:exists}/{controller}/{action}/{id?}",
37+
pattern: "{area:exists}/{controller}/{action}/{id?}",
3838
defaults: new { action = "Index" });
3939
routes.MapControllerRoute(
4040
name: "productRoute",
41-
template: "Product/{action}",
41+
pattern: "Product/{action}",
4242
defaults: new { controller = "Product" });
4343
routes.MapControllerRoute(
4444
name: "default",
45-
template: "{controller}/{action}/{id?}",
45+
pattern: "{controller}/{action}/{id?}",
4646
defaults: new { controller = "HtmlGeneration_Home", action = "Index" });
4747

4848
routes.MapRazorPages();

src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
161161
{
162162
routes.MapControllerRoute(
163163
name: "default",
164-
template: "{controller=Home}/{action=Index}/{id?}");
164+
pattern: "{controller=Home}/{action=Index}/{id?}");
165165
routes.MapRazorPages();
166166
});
167167

src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Startup.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Startup private () =
4444
app.UseRouting(fun routes ->
4545
routes.MapControllerRoute(
4646
name = "default",
47-
template = "{controller=Home}/{action=Index}/{id?}") |> ignore
47+
pattern = "{controller=Home}/{action=Index}/{id?}") |> ignore
4848
routes.MapRazorPages() |> ignore) |> ignore
4949

5050
app.UseAuthorization() |> ignore

0 commit comments

Comments
 (0)