Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static TBuilder WithMetadata<TBuilder>(this TBuilder builder, params obje
/// <returns>The <see cref="IEndpointConventionBuilder"/>.</returns>
public static TBuilder WithName<TBuilder>(this TBuilder builder, string endpointName) where TBuilder : IEndpointConventionBuilder
{
builder.WithMetadata(new EndpointNameAttribute(endpointName));
builder.WithMetadata(new EndpointNameAttribute(endpointName), new RouteNameMetadata(endpointName));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that both IEndpointNameMetadata and IRouteNameMetadata have been around in the same namespace and assembly since at least 3.0. The doc comments for both indicate that they're used for link-generation.

@pranavkm @JamesNK Do either of you know why we have a route name and an enpoint name and how they're used differently?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't know. I didn't touch link generation much. When I worked on routing I focused on endpoint generation and route matching.

return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,20 @@ public void WithMetadata_ChainedCall_ReturnedBuilderIsDerivedType()
public void WithName_SetsEndpointName()
{
// Arrange
var name = "SomeEndpointName";
var builder = CreateBuilder();

// Act
builder.WithName("SomeEndpointName");
builder.WithName(name);

// Assert
var endpoint = builder.Build();

var endpointName = endpoint.Metadata.GetMetadata<IEndpointNameMetadata>();
Assert.Equal("SomeEndpointName", endpointName.EndpointName);
Assert.Equal(name, endpointName.EndpointName);

var routeName = endpoint.Metadata.GetMetadata<IRouteNameMetadata>();
Assert.Equal(name, routeName.RouteName);
}

[Fact]
Expand Down