Skip to content

Rename GroupRouteBuilder to RouteGroupBuilder #41822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ public static class EndpointRouteBuilderExtensions
private static readonly string[] PatchVerb = new[] { HttpMethods.Patch };

/// <summary>
/// Creates a <see cref="GroupRouteBuilder"/> for defining endpoints all prefixed with the specified <paramref name="prefix"/>.
/// Creates a <see cref="RouteGroupBuilder"/> for defining endpoints all prefixed with the specified <paramref name="prefix"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the group to.</param>
/// <param name="prefix">The pattern that prefixes all routes in this group.</param>
/// <returns>
/// A <see cref="GroupRouteBuilder"/> that is both an <see cref="IEndpointRouteBuilder"/> and an <see cref="IEndpointConventionBuilder"/>.
/// A <see cref="RouteGroupBuilder"/> that is both an <see cref="IEndpointRouteBuilder"/> and an <see cref="IEndpointConventionBuilder"/>.
/// The same builder can be used to add endpoints with the given <paramref name="prefix"/>, and to customize those endpoints using conventions.
/// </returns>
public static GroupRouteBuilder MapGroup(this IEndpointRouteBuilder endpoints, string prefix) =>
public static RouteGroupBuilder MapGroup(this IEndpointRouteBuilder endpoints, string prefix) =>
endpoints.MapGroup(RoutePatternFactory.Parse(prefix ?? throw new ArgumentNullException(nameof(prefix))));

/// <summary>
/// Creates a <see cref="GroupRouteBuilder"/> for defining endpoints all prefixed with the specified <paramref name="prefix"/>.
/// Creates a <see cref="RouteGroupBuilder"/> for defining endpoints all prefixed with the specified <paramref name="prefix"/>.
/// </summary>
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the group to.</param>
/// <param name="prefix">The pattern that prefixes all routes in this group.</param>
/// <returns>
/// A <see cref="GroupRouteBuilder"/> that is both an <see cref="IEndpointRouteBuilder"/> and an <see cref="IEndpointConventionBuilder"/>.
/// A <see cref="RouteGroupBuilder"/> that is both an <see cref="IEndpointRouteBuilder"/> and an <see cref="IEndpointConventionBuilder"/>.
/// The same builder can be used to add endpoints with the given <paramref name="prefix"/>, and to customize those endpoints using conventions.
/// </returns>
public static GroupRouteBuilder MapGroup(this IEndpointRouteBuilder endpoints, RoutePattern prefix)
public static RouteGroupBuilder MapGroup(this IEndpointRouteBuilder endpoints, RoutePattern prefix)
{
ArgumentNullException.ThrowIfNull(endpoints, nameof(endpoints));
ArgumentNullException.ThrowIfNull(prefix, nameof(prefix));
Expand Down Expand Up @@ -525,7 +525,7 @@ private static RouteHandlerBuilder Map(

var fullPattern = pattern;

if (endpoints is GroupRouteBuilder group)
if (endpoints is RouteGroupBuilder group)
{
fullPattern = RoutePatternFactory.Combine(group.GroupPrefix, pattern);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Routing/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#nullable enable
Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions
Microsoft.AspNetCore.Routing.GroupRouteBuilder
Microsoft.AspNetCore.Routing.GroupRouteBuilder.GroupPrefix.get -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern!
Microsoft.AspNetCore.Routing.RouteGroupBuilder
Microsoft.AspNetCore.Routing.RouteGroupBuilder.GroupPrefix.get -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern!
Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy(string! token, System.Type! type) -> void
Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy<T>(string! token) -> void
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGroup(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, Microsoft.AspNetCore.Routing.Patterns.RoutePattern! prefix) -> Microsoft.AspNetCore.Routing.GroupRouteBuilder!
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGroup(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! prefix) -> Microsoft.AspNetCore.Routing.GroupRouteBuilder!
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGroup(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, Microsoft.AspNetCore.Routing.Patterns.RoutePattern! prefix) -> Microsoft.AspNetCore.Routing.RouteGroupBuilder!
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGroup(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! prefix) -> Microsoft.AspNetCore.Routing.RouteGroupBuilder!
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPatch(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! pattern, System.Delegate! handler) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPatch(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! pattern, Microsoft.AspNetCore.Http.RequestDelegate! requestDelegate) -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder!
override Microsoft.AspNetCore.Routing.RouteValuesAddress.ToString() -> string?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ namespace Microsoft.AspNetCore.Routing;
/// and <see cref="IEndpointConventionBuilder"/> interfaces. This can be used to add endpoints with the given <see cref="GroupPrefix"/>,
/// and to customize those endpoints using conventions.
/// </summary>
public sealed class GroupRouteBuilder : IEndpointRouteBuilder, IEndpointConventionBuilder
public sealed class RouteGroupBuilder : IEndpointRouteBuilder, IEndpointConventionBuilder
{
private readonly IEndpointRouteBuilder _outerEndpointRouteBuilder;
private readonly RoutePattern _pattern;

private readonly List<EndpointDataSource> _dataSources = new();
private readonly List<Action<EndpointBuilder>> _conventions = new();

internal GroupRouteBuilder(IEndpointRouteBuilder outerEndpointRouteBuilder, RoutePattern pattern)
internal RouteGroupBuilder(IEndpointRouteBuilder outerEndpointRouteBuilder, RoutePattern pattern)
{
_outerEndpointRouteBuilder = outerEndpointRouteBuilder;
_pattern = pattern;

if (outerEndpointRouteBuilder is GroupRouteBuilder outerGroup)
if (outerEndpointRouteBuilder is RouteGroupBuilder outerGroup)
{
GroupPrefix = RoutePatternFactory.Combine(outerGroup.GroupPrefix, pattern);
}
Expand All @@ -39,7 +39,7 @@ internal GroupRouteBuilder(IEndpointRouteBuilder outerEndpointRouteBuilder, Rout
}

/// <summary>
/// The <see cref="RoutePattern"/> prefixing all endpoints defined using this <see cref="GroupRouteBuilder"/>.
/// The <see cref="RoutePattern"/> prefixing all endpoints defined using this <see cref="RouteGroupBuilder"/>.
/// This accounts for nested groups and gives the full group prefix, not just the prefix supplied to the last call to
/// <see cref="EndpointRouteBuilderExtensions.MapGroup(IEndpointRouteBuilder, RoutePattern)"/>.
/// </summary>
Expand All @@ -54,9 +54,9 @@ internal GroupRouteBuilder(IEndpointRouteBuilder outerEndpointRouteBuilder, Rout

private sealed class GroupDataSource : EndpointDataSource
{
private readonly GroupRouteBuilder _groupRouteBuilder;
private readonly RouteGroupBuilder _groupRouteBuilder;

public GroupDataSource(GroupRouteBuilder groupRouteBuilder)
public GroupDataSource(RouteGroupBuilder groupRouteBuilder)
{
_groupRouteBuilder = groupRouteBuilder;
}
Expand Down