@@ -20,8 +20,8 @@ public static class MapActionEndpointRouteBuilderExtensions
20
20
/// </summary>
21
21
/// <param name="endpoints">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
22
22
/// <param name="action">The delegate executed when the endpoint is matched.</param>
23
- /// <returns>A <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
24
- public static IEndpointConventionBuilder MapAction (
23
+ /// <returns>An <see cref="IEndpointConventionBuilder"/> that can be used to further customize the endpoint.</returns>
24
+ public static MapActionEndpointConventionBuilder MapAction (
25
25
this IEndpointRouteBuilder endpoints ,
26
26
Delegate action )
27
27
{
@@ -61,7 +61,6 @@ public static IEndpointConventionBuilder MapAction(
61
61
endpointBuilder . Metadata . Add ( attribute ) ;
62
62
}
63
63
64
-
65
64
endpointBuilder . DisplayName = routeName ?? pattern ;
66
65
67
66
( ( RouteEndpointBuilder ) endpointBuilder ) . Order = routeOrder ?? defaultOrder ;
@@ -75,25 +74,7 @@ public static IEndpointConventionBuilder MapAction(
75
74
throw new InvalidOperationException ( "Action must have a pattern. Is it missing a Route attribute?" ) ;
76
75
}
77
76
78
- return new CompositeEndpointConventionBuilder ( conventionBuilders ) ;
79
- }
80
-
81
- private class CompositeEndpointConventionBuilder : IEndpointConventionBuilder
82
- {
83
- private readonly List < IEndpointConventionBuilder > _endpointConventionBuilders ;
84
-
85
- public CompositeEndpointConventionBuilder ( List < IEndpointConventionBuilder > endpointConventionBuilders )
86
- {
87
- _endpointConventionBuilders = endpointConventionBuilders ;
88
- }
89
-
90
- public void Add ( Action < EndpointBuilder > convention )
91
- {
92
- foreach ( var endpointConventionBuilder in _endpointConventionBuilders )
93
- {
94
- endpointConventionBuilder . Add ( convention ) ;
95
- }
96
- }
77
+ return new MapActionEndpointConventionBuilder ( conventionBuilders ) ;
97
78
}
98
79
}
99
80
}
0 commit comments