Skip to content

Commit dcc1c56

Browse files
committed
Add WithName extension method to resolve #34538
1 parent 396d958 commit dcc1c56

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Http/Routing/src/Builder/RoutingEndpointConventionBuilderExtensions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,18 @@ public static TBuilder WithMetadata<TBuilder>(this TBuilder builder, params obje
118118

119119
return builder;
120120
}
121+
122+
/// <summary>
123+
/// Sets the <see cref="EndpointNameMetadata"/> for all endpoints produced
124+
/// on the target <see cref="IEndpointConventionBuilder"/>.
125+
/// </summary>
126+
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
127+
/// <param name="endpointName">The endpoint name.</param>
128+
/// <returns>The <see cref="IEndpointConventionBuilder"/>.</returns>
129+
public static TBuilder WithName<TBuilder>(this TBuilder builder, string endpointName) where TBuilder : IEndpointConventionBuilder
130+
{
131+
builder.WithMetadata(new EndpointNameMetadata(endpointName));
132+
return builder;
133+
}
121134
}
122135
}

0 commit comments

Comments
 (0)