Browse Source

Rename RouteHandlerFilter to EndpointFilter (#42678)

Stephen Halter 3 years ago
parent
commit
adefeb48ca
28 changed files with 207 additions and 299 deletions
  1. 0 91
      AspNetCore.sln
  2. 3 3
      src/Http/Http.Abstractions/src/DefaultEndpointFilterInvocationContext.cs
  3. 2 2
      src/Http/Http.Abstractions/src/EndpointFilterDelegate.cs
  4. 3 3
      src/Http/Http.Abstractions/src/EndpointFilterFactoryContext.cs
  5. 1 1
      src/Http/Http.Abstractions/src/EndpointFilterInvocationContext.cs
  6. 20 20
      src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.cs
  7. 2 2
      src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.tt
  8. 4 4
      src/Http/Http.Abstractions/src/IEndpointFilter.cs
  9. 4 4
      src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
  10. 18 18
      src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt
  11. 9 9
      src/Http/Http.Abstractions/test/EndpointFilterInvocationContextOfTTests.cs
  12. 3 3
      src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj
  13. 2 2
      src/Http/Http.Extensions/src/PublicAPI.Unshipped.txt
  14. 36 36
      src/Http/Http.Extensions/src/RequestDelegateFactory.cs
  15. 1 1
      src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs
  16. 21 21
      src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
  17. 24 25
      src/Http/Routing/src/Builder/EndpointFilterExtensions.cs
  18. 2 2
      src/Http/Routing/src/CompositeEndpointDataSource.cs
  19. 1 1
      src/Http/Routing/src/EndpointDataSource.cs
  20. 9 9
      src/Http/Routing/src/PublicAPI.Unshipped.txt
  21. 6 6
      src/Http/Routing/src/RouteEndpointBuilder.cs
  22. 3 3
      src/Http/Routing/src/RouteEndpointDataSource.cs
  23. 3 3
      src/Http/Routing/src/RouteGroupBuilder.cs
  24. 3 3
      src/Http/Routing/src/RouteGroupContext.cs
  25. 3 3
      src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs
  26. 18 18
      src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs
  27. 4 4
      src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs
  28. 2 2
      src/Http/samples/MinimalSample/Program.cs

+ 0 - 91
AspNetCore.sln

@@ -2612,86 +2612,6 @@ Global
 		{78C5ACC3-6718-4682-B350-737EDA1E4F35}.Release|x64.Build.0 = Release|Any CPU
 		{78C5ACC3-6718-4682-B350-737EDA1E4F35}.Release|x86.ActiveCfg = Release|Any CPU
 		{78C5ACC3-6718-4682-B350-737EDA1E4F35}.Release|x86.Build.0 = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|arm64.ActiveCfg = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|arm64.Build.0 = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|x64.Build.0 = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Debug|x86.Build.0 = Debug|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|Any CPU.Build.0 = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|arm64.ActiveCfg = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|arm64.Build.0 = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|x64.ActiveCfg = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|x64.Build.0 = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|x86.ActiveCfg = Release|Any CPU
-		{42E30C98-1358-497F-960B-E1AA17F46704}.Release|x86.Build.0 = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|arm64.ActiveCfg = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|arm64.Build.0 = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|x64.Build.0 = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Debug|x86.Build.0 = Debug|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|Any CPU.Build.0 = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|arm64.ActiveCfg = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|arm64.Build.0 = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|x64.ActiveCfg = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|x64.Build.0 = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|x86.ActiveCfg = Release|Any CPU
-		{4870B11E-7F67-4757-BC9A-45E5895AC712}.Release|x86.Build.0 = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|arm64.ActiveCfg = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|arm64.Build.0 = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|x64.Build.0 = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Debug|x86.Build.0 = Debug|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|arm64.ActiveCfg = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|arm64.Build.0 = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|x64.ActiveCfg = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|x64.Build.0 = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|x86.ActiveCfg = Release|Any CPU
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A}.Release|x86.Build.0 = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|arm64.ActiveCfg = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|arm64.Build.0 = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|x64.Build.0 = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Debug|x86.Build.0 = Debug|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|Any CPU.Build.0 = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|arm64.ActiveCfg = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|arm64.Build.0 = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|x64.ActiveCfg = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|x64.Build.0 = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|x86.ActiveCfg = Release|Any CPU
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0}.Release|x86.Build.0 = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|arm64.ActiveCfg = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|arm64.Build.0 = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|x64.Build.0 = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Debug|x86.Build.0 = Debug|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|Any CPU.Build.0 = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|arm64.ActiveCfg = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|arm64.Build.0 = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|x64.ActiveCfg = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|x64.Build.0 = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|x86.ActiveCfg = Release|Any CPU
-		{B70B1843-4360-4731-9D5C-599189CC1198}.Release|x86.Build.0 = Release|Any CPU
 		{D40C86C9-0E5D-4974-84D8-A835B58B2A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{D40C86C9-0E5D-4974-84D8-A835B58B2A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{D40C86C9-0E5D-4974-84D8-A835B58B2A8F}.Debug|arm64.ActiveCfg = Debug|Any CPU
@@ -10623,15 +10543,6 @@ Global
 		{C73F3203-4E8C-46BC-A299-1A5BB81DA2C3} = {021E9BF3-2D3D-4169-834E-718ABE0E5B68}
 		{78C5ACC3-6718-4682-B350-737EDA1E4F35} = {B55A5DE1-5AF3-4B18-AF04-C1735B071DA6}
 		{DFDEED51-6B9B-41B9-A684-9F3FFC07C9B4} = {017429CC-C5FB-48B4-9C46-034E29EE2F06}
-		{2757D342-5E89-4C4B-9659-714AC8536FD4} = {DFDEED51-6B9B-41B9-A684-9F3FFC07C9B4}
-		{CE6853C2-73AE-42EB-AD8C-2A094B2A4A36} = {2757D342-5E89-4C4B-9659-714AC8536FD4}
-		{42E30C98-1358-497F-960B-E1AA17F46704} = {CE6853C2-73AE-42EB-AD8C-2A094B2A4A36}
-		{4870B11E-7F67-4757-BC9A-45E5895AC712} = {CE6853C2-73AE-42EB-AD8C-2A094B2A4A36}
-		{B95A22C8-71B7-49DE-94B2-16402A36B914} = {2757D342-5E89-4C4B-9659-714AC8536FD4}
-		{600BF48B-F5DF-4C9D-A5A7-635A8DD6C32A} = {B95A22C8-71B7-49DE-94B2-16402A36B914}
-		{27DF3ACF-F3ED-4D76-BFCB-57251892ABC0} = {B95A22C8-71B7-49DE-94B2-16402A36B914}
-		{16653D2A-AC79-44ED-B908-2EEB58684C50} = {2757D342-5E89-4C4B-9659-714AC8536FD4}
-		{B70B1843-4360-4731-9D5C-599189CC1198} = {16653D2A-AC79-44ED-B908-2EEB58684C50}
 		{4FDDC525-4E60-4CAF-83A3-261C5B43721F} = {0ACCEDA7-339C-4B4D-8DD4-1AC271F31C04}
 		{89472057-8BB2-44A8-B0FC-D9F3ADB1181C} = {4FDDC525-4E60-4CAF-83A3-261C5B43721F}
 		{D40C86C9-0E5D-4974-84D8-A835B58B2A8F} = {89472057-8BB2-44A8-B0FC-D9F3ADB1181C}
@@ -11281,8 +11192,6 @@ Global
 		{2A150BE3-D7DC-4E2A-8399-6EBAB77DEF00} = {B5D98AEB-9409-4280-8225-9C1EC6A791B2}
 		{D5F4D764-887D-4EB3-8D00-FCBE23FFDBBC} = {B5D98AEB-9409-4280-8225-9C1EC6A791B2}
 		{40F493E2-FE59-4787-BE44-3AED39D585BF} = {4DA84F2B-1948-439B-85AB-E99E31331A9C}
-		{5420BABA-BDC5-4FBF-81B4-6D7C02C4814D} = {16653D2A-AC79-44ED-B908-2EEB58684C50}
-		{05F4BC5A-060D-49B2-9069-95088402F99B} = {5420BABA-BDC5-4FBF-81B4-6D7C02C4814D}
 		{97F9F7E9-56DA-49FE-B672-499E68EBB9DA} = {41B519F7-CF19-4FB4-B96C-E38A7EF45F70}
 		{6F335C66-C1D6-45FA-8529-6503B7CD42CC} = {97F9F7E9-56DA-49FE-B672-499E68EBB9DA}
 		{71A54D7F-245F-43C2-B429-342D80AC6F23} = {97F9F7E9-56DA-49FE-B672-499E68EBB9DA}

+ 3 - 3
src/Http/Http.Abstractions/src/DefaultRouteHandlerInvocationContext.cs → src/Http/Http.Abstractions/src/DefaultEndpointFilterInvocationContext.cs

@@ -7,14 +7,14 @@ namespace Microsoft.AspNetCore.Http;
 /// Provides a default implementation for wrapping the <see cref="HttpContext"/> and parameters
 /// provided to a route handler.
 /// </summary>
-public sealed class DefaultRouteHandlerInvocationContext : RouteHandlerInvocationContext
+public sealed class DefaultEndpointFilterInvocationContext : EndpointFilterInvocationContext
 {
     /// <summary>
-    /// Creates a new instance of the <see cref="DefaultRouteHandlerInvocationContext"/> for a given request.
+    /// Creates a new instance of the <see cref="DefaultEndpointFilterInvocationContext"/> for a given request.
     /// </summary>
     /// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
     /// <param name="arguments">A list of parameters provided in the current request.</param>
-    public DefaultRouteHandlerInvocationContext(HttpContext httpContext, params object[] arguments)
+    public DefaultEndpointFilterInvocationContext(HttpContext httpContext, params object[] arguments)
     {
         HttpContext = httpContext;
         Arguments = arguments;

+ 2 - 2
src/Http/Http.Abstractions/src/RouteHandlerFilterDelegate.cs → src/Http/Http.Abstractions/src/EndpointFilterDelegate.cs

@@ -6,8 +6,8 @@ namespace Microsoft.AspNetCore.Http;
 /// <summary>
 /// A delegate that is applied as a filter on a route handler.
 /// </summary>
-/// <param name="context">The <see cref="RouteHandlerInvocationContext"/> associated with the current request.</param>
+/// <param name="context">The <see cref="EndpointFilterInvocationContext"/> associated with the current request.</param>
 /// <returns>
 /// A <see cref="ValueTask"/> result of calling the handler and applying any modifications made by filters in the pipeline.
 /// </returns>
-public delegate ValueTask<object?> RouteHandlerFilterDelegate(RouteHandlerInvocationContext context);
+public delegate ValueTask<object?> EndpointFilterDelegate(EndpointFilterInvocationContext context);

+ 3 - 3
src/Http/Http.Abstractions/src/RouteHandlerContext.cs → src/Http/Http.Abstractions/src/EndpointFilterFactoryContext.cs

@@ -10,15 +10,15 @@ namespace Microsoft.AspNetCore.Http;
 /// Represents the information accessible via the route handler filter
 /// API when the user is constructing a new route handler.
 /// </summary>
-public sealed class RouteHandlerContext
+public sealed class EndpointFilterFactoryContext
 {
     /// <summary>
-    /// Creates a new instance of the <see cref="RouteHandlerContext"/>.
+    /// Creates a new instance of the <see cref="EndpointFilterFactoryContext"/>.
     /// </summary>
     /// <param name="methodInfo">The <see cref="MethodInfo"/> associated with the route handler of the current request.</param>
     /// <param name="endpointMetadata">The <see cref="EndpointBuilder.Metadata"/> associated with the endpoint the filter is targeting.</param>
     /// <param name="applicationServices">The <see cref="IServiceProvider"/> instance used to access the application services.</param>
-    public RouteHandlerContext(MethodInfo methodInfo, IList<object> endpointMetadata, IServiceProvider applicationServices)
+    public EndpointFilterFactoryContext(MethodInfo methodInfo, IList<object> endpointMetadata, IServiceProvider applicationServices)
     {
         ArgumentNullException.ThrowIfNull(methodInfo);
         ArgumentNullException.ThrowIfNull(endpointMetadata);

+ 1 - 1
src/Http/Http.Abstractions/src/RouteHandlerInvocationContext.cs → src/Http/Http.Abstractions/src/EndpointFilterInvocationContext.cs

@@ -7,7 +7,7 @@ namespace Microsoft.AspNetCore.Http;
 /// Provides an abstraction for wrapping the <see cref="HttpContext"/> and arguments
 /// provided to a route handler.
 /// </summary>
-public abstract class RouteHandlerInvocationContext
+public abstract class EndpointFilterInvocationContext
 {
     /// <summary>
     /// The <see cref="HttpContext"/> associated with the current request being processed by the filter.

+ 20 - 20
src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.cs → src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.cs

@@ -9,9 +9,9 @@ using System.CodeDom.Compiler;
 namespace Microsoft.AspNetCore.Http;
 
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -115,9 +115,9 @@ internal sealed class RouteHandlerInvocationContext<T0> : RouteHandlerInvocation
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -228,9 +228,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1> : RouteHandlerInvoca
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -348,9 +348,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2> : RouteHandlerIn
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -475,9 +475,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3> : RouteHandl
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -609,9 +609,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4> : RouteH
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4, T5> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -750,9 +750,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5> : Ro
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4, T5, T6> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -898,9 +898,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6>
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -1053,9 +1053,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6,
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7, T8> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7, T8> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
     {
         HttpContext = httpContext;
         Arg0 = arg0;
@@ -1215,9 +1215,9 @@ internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6,
     }
 }
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
     {
         HttpContext = httpContext;
         Arg0 = arg0;

+ 2 - 2
src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.tt → src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.tt

@@ -17,9 +17,9 @@ namespace Microsoft.AspNetCore.Http;
 
 <# foreach (var arity in arities) { #>
 [GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext<<# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>T<#=argumentCount#><# if (argumentCount < arity - 1) { #>, <# } #><# } #>> : RouteHandlerInvocationContext, IList<object?>
+internal sealed class EndpointFilterInvocationContext<<# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>T<#=argumentCount#><# if (argumentCount < arity - 1) { #>, <# } #><# } #>> : EndpointFilterInvocationContext, IList<object?>
 {
-    internal RouteHandlerInvocationContext(HttpContext httpContext, <# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>T<#=argumentCount#> arg<#=argumentCount#><# if (argumentCount < arity - 1) { #>, <# } #><# } #>)
+    internal EndpointFilterInvocationContext(HttpContext httpContext, <# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>T<#=argumentCount#> arg<#=argumentCount#><# if (argumentCount < arity - 1) { #>, <# } #><# } #>)
     {
         HttpContext = httpContext;
 <# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>        Arg<#=argumentCount#> = arg<#=argumentCount#>;

+ 4 - 4
src/Http/Http.Abstractions/src/IRouteHandlerFilter.cs → src/Http/Http.Abstractions/src/IEndpointFilter.cs

@@ -6,15 +6,15 @@ namespace Microsoft.AspNetCore.Http;
 /// <summary>
 /// Provides an interface for implementing a filter targetting a route handler.
 /// </summary>
-public interface IRouteHandlerFilter
+public interface IEndpointFilter
 {
     /// <summary>
-    /// Implements the core logic associated with the filter given a <see cref="RouteHandlerInvocationContext"/>
+    /// Implements the core logic associated with the filter given a <see cref="EndpointFilterInvocationContext"/>
     /// and the next filter to call in the pipeline.
     /// </summary>
-    /// <param name="context">The <see cref="RouteHandlerInvocationContext"/> associated with the current request/response.</param>
+    /// <param name="context">The <see cref="EndpointFilterInvocationContext"/> associated with the current request/response.</param>
     /// <param name="next">The next filter in the pipeline.</param>
     /// <returns>An awaitable result of calling the handler and apply
     /// any modifications made by filters in the pipeline.</returns>
-    ValueTask<object?> InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next);
+    ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next);
 }

+ 4 - 4
src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj

@@ -34,9 +34,9 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
   </ItemGroup>
 
   <ItemGroup>
-    <None Update="RouteHandlerInvocationContextOfT.Generated.tt">
+    <None Update="EndpointFilterInvocationContextOfT.Generated.tt">
       <Generator>TextTemplatingFileGenerator</Generator>
-      <LastGenOutput>RouteHandlerInvocationContextOfT.Generated.cs</LastGenOutput>
+      <LastGenOutput>EndpointFilterInvocationContextOfT.Generated.cs</LastGenOutput>
     </None>
   </ItemGroup>
 
@@ -45,10 +45,10 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Update="RouteHandlerInvocationContextOfT.Generated.cs">
+    <Compile Update="EndpointFilterInvocationContextOfT.Generated.cs">
       <DesignTime>True</DesignTime>
       <AutoGen>True</AutoGen>
-      <DependentUpon>RouteHandlerInvocationContextOfT.Generated.tt</DependentUpon>
+      <DependentUpon>EndpointFilterInvocationContextOfT.Generated.tt</DependentUpon>
     </Compile>
   </ItemGroup>
 

+ 18 - 18
src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt

@@ -1,25 +1,37 @@
 #nullable enable
 *REMOVED*abstract Microsoft.AspNetCore.Http.HttpResponse.ContentType.get -> string!
 *REMOVED*Microsoft.AspNetCore.Http.EndpointMetadataCollection.Enumerator.Current.get -> object?
+abstract Microsoft.AspNetCore.Http.EndpointFilterInvocationContext.Arguments.get -> System.Collections.Generic.IList<object?>!
+abstract Microsoft.AspNetCore.Http.EndpointFilterInvocationContext.GetArgument<T>(int index) -> T
+abstract Microsoft.AspNetCore.Http.EndpointFilterInvocationContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!
 Microsoft.AspNetCore.Builder.EndpointBuilder.ApplicationServices.get -> System.IServiceProvider!
 Microsoft.AspNetCore.Builder.EndpointBuilder.ApplicationServices.set -> void
 Microsoft.AspNetCore.Http.AsParametersAttribute
 Microsoft.AspNetCore.Http.AsParametersAttribute.AsParametersAttribute() -> void
 Microsoft.AspNetCore.Http.CookieBuilder.Extensions.get -> System.Collections.Generic.IList<string!>!
-Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext
-Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext.DefaultRouteHandlerInvocationContext(Microsoft.AspNetCore.Http.HttpContext! httpContext, params object![]! arguments) -> void
+Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext
+Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.DefaultEndpointFilterInvocationContext(Microsoft.AspNetCore.Http.HttpContext! httpContext, params object![]! arguments) -> void
+Microsoft.AspNetCore.Http.EndpointFilterDelegate
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext.ApplicationServices.get -> System.IServiceProvider!
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext.EndpointFilterFactoryContext(System.Reflection.MethodInfo! methodInfo, System.Collections.Generic.IList<object!>! endpointMetadata, System.IServiceProvider! applicationServices) -> void
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext.EndpointMetadata.get -> System.Collections.Generic.IList<object!>!
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext.MethodInfo.get -> System.Reflection.MethodInfo!
+Microsoft.AspNetCore.Http.EndpointFilterInvocationContext
+Microsoft.AspNetCore.Http.EndpointFilterInvocationContext.EndpointFilterInvocationContext() -> void
 Microsoft.AspNetCore.Http.EndpointMetadataCollection.Enumerator.Current.get -> object!
 Microsoft.AspNetCore.Http.EndpointMetadataCollection.GetRequiredMetadata<T>() -> T!
 Microsoft.AspNetCore.Http.IBindableFromHttpContext<TSelf>
 Microsoft.AspNetCore.Http.IBindableFromHttpContext<TSelf>.BindAsync(Microsoft.AspNetCore.Http.HttpContext! context, System.Reflection.ParameterInfo! parameter) -> System.Threading.Tasks.ValueTask<TSelf?>
 Microsoft.AspNetCore.Http.IContentTypeHttpResult
 Microsoft.AspNetCore.Http.IContentTypeHttpResult.ContentType.get -> string?
+Microsoft.AspNetCore.Http.IEndpointFilter
+Microsoft.AspNetCore.Http.IEndpointFilter.InvokeAsync(Microsoft.AspNetCore.Http.EndpointFilterInvocationContext! context, Microsoft.AspNetCore.Http.EndpointFilterDelegate! next) -> System.Threading.Tasks.ValueTask<object?>
 Microsoft.AspNetCore.Http.IFileHttpResult
 Microsoft.AspNetCore.Http.IFileHttpResult.ContentType.get -> string?
 Microsoft.AspNetCore.Http.IFileHttpResult.FileDownloadName.get -> string?
 Microsoft.AspNetCore.Http.INestedHttpResult
 Microsoft.AspNetCore.Http.INestedHttpResult.Result.get -> Microsoft.AspNetCore.Http.IResult!
-Microsoft.AspNetCore.Http.IRouteHandlerFilter.InvokeAsync(Microsoft.AspNetCore.Http.RouteHandlerInvocationContext! context, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate! next) -> System.Threading.Tasks.ValueTask<object?>
 Microsoft.AspNetCore.Http.IStatusCodeHttpResult
 Microsoft.AspNetCore.Http.IStatusCodeHttpResult.StatusCode.get -> int?
 Microsoft.AspNetCore.Http.IValueHttpResult
@@ -30,27 +42,15 @@ Microsoft.AspNetCore.Http.Metadata.IFromFormMetadata
 Microsoft.AspNetCore.Http.Metadata.IFromFormMetadata.Name.get -> string?
 Microsoft.AspNetCore.Http.Metadata.IRequestSizeLimitMetadata
 Microsoft.AspNetCore.Http.Metadata.IRequestSizeLimitMetadata.MaxRequestBodySize.get -> long?
-Microsoft.AspNetCore.Http.RouteHandlerContext
-Microsoft.AspNetCore.Http.RouteHandlerContext.ApplicationServices.get -> System.IServiceProvider!
-Microsoft.AspNetCore.Http.RouteHandlerContext.EndpointMetadata.get -> System.Collections.Generic.IList<object!>!
-Microsoft.AspNetCore.Http.RouteHandlerContext.MethodInfo.get -> System.Reflection.MethodInfo!
-Microsoft.AspNetCore.Http.RouteHandlerContext.RouteHandlerContext(System.Reflection.MethodInfo! methodInfo, System.Collections.Generic.IList<object!>! endpointMetadata, System.IServiceProvider! applicationServices) -> void
-Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate
-Microsoft.AspNetCore.Http.RouteHandlerInvocationContext
-Microsoft.AspNetCore.Http.RouteHandlerInvocationContext.RouteHandlerInvocationContext() -> void
 Microsoft.AspNetCore.Routing.RouteValueDictionary.RouteValueDictionary(Microsoft.AspNetCore.Routing.RouteValueDictionary? dictionary) -> void
 Microsoft.AspNetCore.Routing.RouteValueDictionary.RouteValueDictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>? values) -> void
 Microsoft.AspNetCore.Routing.RouteValueDictionary.RouteValueDictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, string?>>? values) -> void
 abstract Microsoft.AspNetCore.Http.HttpResponse.ContentType.get -> string?
 Microsoft.AspNetCore.Http.Metadata.ISkipStatusCodePagesMetadata
-Microsoft.AspNetCore.Http.IRouteHandlerFilter
 Microsoft.AspNetCore.Http.Metadata.IEndpointDescriptionMetadata
 Microsoft.AspNetCore.Http.Metadata.IEndpointDescriptionMetadata.Description.get -> string!
 Microsoft.AspNetCore.Http.Metadata.IEndpointSummaryMetadata
 Microsoft.AspNetCore.Http.Metadata.IEndpointSummaryMetadata.Summary.get -> string!
-abstract Microsoft.AspNetCore.Http.RouteHandlerInvocationContext.Arguments.get -> System.Collections.Generic.IList<object?>!
-abstract Microsoft.AspNetCore.Http.RouteHandlerInvocationContext.GetArgument<T>(int index) -> T
-abstract Microsoft.AspNetCore.Http.RouteHandlerInvocationContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!
-override Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext.Arguments.get -> System.Collections.Generic.IList<object?>!
-override Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext.GetArgument<T>(int index) -> T
-override Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!
+override Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.Arguments.get -> System.Collections.Generic.IList<object?>!
+override Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.GetArgument<T>(int index) -> T
+override Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!

+ 9 - 9
src/Http/Http.Abstractions/test/RouteHandlerInvocationContextOfTTests.cs → src/Http/Http.Abstractions/test/EndpointFilterInvocationContextOfTTests.cs

@@ -4,12 +4,12 @@ using Mono.TextTemplating;
 
 namespace Microsoft.AspNetCore.Http.Abstractions.Tests;
 
-public class RouteHandlerInvocationContextOfTTests
+public class EndpointFilterInvocationContextOfTTests
 {
     [Fact]
     public void ProhibitsActionsThatModifyListSize()
     {
-        var context = new RouteHandlerInvocationContext<string, int, bool>(new DefaultHttpContext(), "This is a test", 42, false);
+        var context = new EndpointFilterInvocationContext<string, int, bool>(new DefaultHttpContext(), "This is a test", 42, false);
         Assert.Throws<NotSupportedException>(() => context.Add("string"));
         Assert.Throws<NotSupportedException>(() => context.Insert(0, "string"));
         Assert.Throws<NotSupportedException>(() => context.RemoveAt(0));
@@ -20,7 +20,7 @@ public class RouteHandlerInvocationContextOfTTests
     [Fact]
     public void ThrowsExceptionForInvalidCastOnGetArgument()
     {
-        var context = new RouteHandlerInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+        var context = new EndpointFilterInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
         Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(1));
         Assert.Throws<InvalidCastException>(() => context.GetArgument<int>(0));
         Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(3));
@@ -31,7 +31,7 @@ public class RouteHandlerInvocationContextOfTTests
     [Fact]
     public void SetterAllowsInPlaceModificationOfParameters()
     {
-        var context = new RouteHandlerInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+        var context = new EndpointFilterInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
         context[0] = "Foo";
         Assert.Equal("Foo", context.GetArgument<string>(0));
     }
@@ -39,14 +39,14 @@ public class RouteHandlerInvocationContextOfTTests
     [Fact]
     public void SetterDoesNotAllowModificationOfParameterType()
     {
-        var context = new RouteHandlerInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+        var context = new EndpointFilterInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
         Assert.Throws<InvalidCastException>(() => context[0] = 4);
     }
 
     [Fact]
     public void AllowsEnumerationOfParameters()
     {
-        var context = new RouteHandlerInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+        var context = new EndpointFilterInvocationContext<string, int, bool, Todo>(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
         var enumeratedCount = 0;
         foreach (var parameter in context)
         {
@@ -60,7 +60,7 @@ public class RouteHandlerInvocationContextOfTTests
     [Fact]
     public void HandlesMismatchedNullabilityOnTypeParams()
     {
-        var context = new RouteHandlerInvocationContext<string?, int?, bool?, Todo?>(new DefaultHttpContext(), null, null, null, null);
+        var context = new EndpointFilterInvocationContext<string?, int?, bool?, Todo?>(new DefaultHttpContext(), null, null, null, null);
         // Mismatched reference types will resolve as null
         Assert.Null(context.GetArgument<string>(0));
         Assert.Null(context.GetArgument<Todo>(3));
@@ -72,8 +72,8 @@ public class RouteHandlerInvocationContextOfTTests
     [Fact]
     public void GeneratedCodeIsUpToDate()
     {
-        var currentContentPath = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "RouteHandlerInvocationContextOfT.Generated.cs");
-        var templatePath = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "RouteHandlerInvocationContextOfT.Generated.tt");
+        var currentContentPath = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "EndpointFilterInvocationContextOfT.Generated.cs");
+        var templatePath = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "EndpointFilterInvocationContextOfT.Generated.tt");
 
         var generator = new TemplateGenerator();
         var compiledTemplate = generator.CompileTemplate(File.ReadAllText(templatePath));

+ 3 - 3
src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj

@@ -16,9 +16,9 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Content Include="$(MSBuildThisFileDirectory)\..\src\RouteHandlerInvocationContextOfT.Generated.tt" LinkBase="Shared\GeneratedContent" CopyToOutputDirectory="PreserveNewest" />
-    <Content Include="$(MSBuildThisFileDirectory)\..\src\RouteHandlerInvocationContextOfT.Generated.cs" LinkBase="Shared\GeneratedContent" CopyToOutputDirectory="PreserveNewest" />
-    <Compile Update="RouteHandlerInvocationContextOfT.Generated.cs" Link="Shared\GeneratedContent\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
+    <Content Include="$(MSBuildThisFileDirectory)\..\src\EndpointFilterInvocationContextOfT.Generated.tt" LinkBase="Shared\GeneratedContent" CopyToOutputDirectory="PreserveNewest" />
+    <Content Include="$(MSBuildThisFileDirectory)\..\src\EndpointFilterInvocationContextOfT.Generated.cs" LinkBase="Shared\GeneratedContent" CopyToOutputDirectory="PreserveNewest" />
+    <Compile Update="EndpointFilterInvocationContextOfT.Generated.cs" Link="Shared\GeneratedContent\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
 
 </Project>

+ 2 - 2
src/Http/Http.Extensions/src/PublicAPI.Unshipped.txt

@@ -13,10 +13,10 @@ Microsoft.AspNetCore.Http.Metadata.IEndpointMetadataProvider
 Microsoft.AspNetCore.Http.Metadata.IEndpointMetadataProvider.PopulateMetadata(Microsoft.AspNetCore.Http.Metadata.EndpointMetadataContext! context) -> void
 Microsoft.AspNetCore.Http.Metadata.IEndpointParameterMetadataProvider
 Microsoft.AspNetCore.Http.Metadata.IEndpointParameterMetadataProvider.PopulateMetadata(Microsoft.AspNetCore.Http.Metadata.EndpointParameterMetadataContext! parameterContext) -> void
+Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointFilterFactories.get -> System.Collections.Generic.IReadOnlyList<System.Func<Microsoft.AspNetCore.Http.EndpointFilterFactoryContext!, Microsoft.AspNetCore.Http.EndpointFilterDelegate!, Microsoft.AspNetCore.Http.EndpointFilterDelegate!>!>?
+Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointFilterFactories.init -> void
 Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointMetadata.get -> System.Collections.Generic.IList<object!>?
 Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointMetadata.init -> void
-Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.RouteHandlerFilterFactories.get -> System.Collections.Generic.IReadOnlyList<System.Func<Microsoft.AspNetCore.Http.RouteHandlerContext!, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate!, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate!>!>?
-Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.RouteHandlerFilterFactories.init -> void
 Microsoft.Extensions.DependencyInjection.RouteHandlerJsonServiceExtensions
 static Microsoft.AspNetCore.Http.HttpRequestJsonExtensions.ReadFromJsonAsync(this Microsoft.AspNetCore.Http.HttpRequest! request, System.Type! type, System.Text.Json.Serialization.JsonSerializerContext! context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<object?>
 static Microsoft.AspNetCore.Http.HttpRequestJsonExtensions.ReadFromJsonAsync<TValue>(this Microsoft.AspNetCore.Http.HttpRequest! request, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue>! jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<TValue?>

+ 36 - 36
src/Http/Http.Extensions/src/RequestDelegateFactory.cs

@@ -102,15 +102,15 @@ public static partial class RequestDelegateFactory
     private static readonly BinaryExpression TempSourceStringNullExpr = Expression.Equal(TempSourceStringExpr, Expression.Constant(null));
     private static readonly UnaryExpression TempSourceStringIsNotNullOrEmptyExpr = Expression.Not(Expression.Call(StringIsNullOrEmptyMethod, TempSourceStringExpr));
 
-    private static readonly ConstructorInfo DefaultRouteHandlerInvocationContextConstructor = typeof(DefaultRouteHandlerInvocationContext).GetConstructor(new[] { typeof(HttpContext), typeof(object[]) })!;
-    private static readonly MethodInfo RouteHandlerInvocationContextGetArgument = typeof(RouteHandlerInvocationContext).GetMethod(nameof(RouteHandlerInvocationContext.GetArgument))!;
+    private static readonly ConstructorInfo DefaultEndpointFilterInvocationContextConstructor = typeof(DefaultEndpointFilterInvocationContext).GetConstructor(new[] { typeof(HttpContext), typeof(object[]) })!;
+    private static readonly MethodInfo EndpointFilterInvocationContextGetArgument = typeof(EndpointFilterInvocationContext).GetMethod(nameof(EndpointFilterInvocationContext.GetArgument))!;
     private static readonly PropertyInfo ListIndexer = typeof(IList<object>).GetProperty("Item")!;
-    private static readonly ParameterExpression FilterContextExpr = Expression.Parameter(typeof(RouteHandlerInvocationContext), "context");
-    private static readonly MemberExpression FilterContextHttpContextExpr = Expression.Property(FilterContextExpr, typeof(RouteHandlerInvocationContext).GetProperty(nameof(RouteHandlerInvocationContext.HttpContext))!);
-    private static readonly MemberExpression FilterContextArgumentsExpr = Expression.Property(FilterContextExpr, typeof(RouteHandlerInvocationContext).GetProperty(nameof(RouteHandlerInvocationContext.Arguments))!);
+    private static readonly ParameterExpression FilterContextExpr = Expression.Parameter(typeof(EndpointFilterInvocationContext), "context");
+    private static readonly MemberExpression FilterContextHttpContextExpr = Expression.Property(FilterContextExpr, typeof(EndpointFilterInvocationContext).GetProperty(nameof(EndpointFilterInvocationContext.HttpContext))!);
+    private static readonly MemberExpression FilterContextArgumentsExpr = Expression.Property(FilterContextExpr, typeof(EndpointFilterInvocationContext).GetProperty(nameof(EndpointFilterInvocationContext.Arguments))!);
     private static readonly MemberExpression FilterContextHttpContextResponseExpr = Expression.Property(FilterContextHttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!);
     private static readonly MemberExpression FilterContextHttpContextStatusCodeExpr = Expression.Property(FilterContextHttpContextResponseExpr, typeof(HttpResponse).GetProperty(nameof(HttpResponse.StatusCode))!);
-    private static readonly ParameterExpression InvokedFilterContextExpr = Expression.Parameter(typeof(RouteHandlerInvocationContext), "filterContext");
+    private static readonly ParameterExpression InvokedFilterContextExpr = Expression.Parameter(typeof(EndpointFilterInvocationContext), "filterContext");
 
     private static readonly string[] DefaultAcceptsContentType = new[] { "application/json" };
     private static readonly string[] FormFileContentType = new[] { "multipart/form-data" };
@@ -208,7 +208,7 @@ public static partial class RequestDelegateFactory
             RouteParameters = options?.RouteParameterNames?.ToList(),
             ThrowOnBadRequest = options?.ThrowOnBadRequest ?? false,
             DisableInferredFromBody = options?.DisableInferBodyFromParameters ?? false,
-            FilterFactories = options?.RouteHandlerFilterFactories?.ToList(),
+            FilterFactories = options?.EndpointFilterFactories?.ToList(),
             Metadata = options?.EndpointMetadata ?? new List<object>(),
         };
     }
@@ -252,7 +252,7 @@ public static partial class RequestDelegateFactory
             factoryContext.ServiceProvider,
             CollectionsMarshal.AsSpan(factoryContext.Parameters));
 
-        RouteHandlerFilterDelegate? filterPipeline = null;
+        EndpointFilterDelegate? filterPipeline = null;
 
         // If there are filters registered on the route handler, then we update the method call and
         // return type associated with the request to allow for the filter invocation pipeline.
@@ -262,15 +262,15 @@ public static partial class RequestDelegateFactory
 
             if (filterPipeline is not null)
             {
-                Expression<Func<RouteHandlerInvocationContext, ValueTask<object?>>> invokePipeline = (context) => filterPipeline(context);
+                Expression<Func<EndpointFilterInvocationContext, ValueTask<object?>>> invokePipeline = (context) => filterPipeline(context);
                 returnType = typeof(ValueTask<object?>);
-                // var filterContext = new RouteHandlerInvocationContext<string, int>(httpContext, name_local, int_local);
+                // var filterContext = new EndpointFilterInvocationContext<string, int>(httpContext, name_local, int_local);
                 // invokePipeline.Invoke(filterContext);
                 factoryContext.MethodCall = Expression.Block(
                     new[] { InvokedFilterContextExpr },
                     Expression.Assign(
                         InvokedFilterContextExpr,
-                        CreateRouteHandlerInvocationContextBase(factoryContext)),
+                        CreateEndpointFilterInvocationContextBase(factoryContext)),
                         Expression.Invoke(invokePipeline, InvokedFilterContextExpr)
                     );
             }
@@ -298,7 +298,7 @@ public static partial class RequestDelegateFactory
         return HandleRequestBodyAndCompileRequestDelegate(responseWritingMethodCall, factoryContext);
     }
 
-    private static RouteHandlerFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, FactoryContext factoryContext, Expression<Func<HttpContext, object?>>? targetFactory)
+    private static EndpointFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, FactoryContext factoryContext, Expression<Func<HttpContext, object?>>? targetFactory)
     {
         Debug.Assert(factoryContext.FilterFactories is not null);
         // httpContext.Response.StatusCode >= 400
@@ -314,10 +314,10 @@ public static partial class RequestDelegateFactory
         //  When `handler` returns an object, we generate the following wrapper
         //  to convert it to `ValueTask<object?>` as expected in the filter
         //  pipeline.
-        //      ValueTask<object?>.FromResult(handler(RouteHandlerInvocationContext.GetArgument<string>(0), RouteHandlerInvocationContext.GetArgument<int>(1)));
+        //      ValueTask<object?>.FromResult(handler(EndpointFilterInvocationContext.GetArgument<string>(0), EndpointFilterInvocationContext.GetArgument<int>(1)));
         //  When the `handler` is a generic Task or ValueTask we await the task and
         //  create a `ValueTask<object?> from the resulting value.
-        //      new ValueTask<object?>(await handler(RouteHandlerInvocationContext.GetArgument<string>(0), RouteHandlerInvocationContext.GetArgument<int>(1)));
+        //      new ValueTask<object?>(await handler(EndpointFilterInvocationContext.GetArgument<string>(0), EndpointFilterInvocationContext.GetArgument<int>(1)));
         //  When the `handler` returns a void or a void-returning Task, then we return an EmptyHttpResult
         //  to as a ValueTask<object?>
         // }
@@ -333,13 +333,13 @@ public static partial class RequestDelegateFactory
                         : Expression.Assign(TargetExpr, Expression.Invoke(targetFactory, FilterContextHttpContextExpr)),
                     handlerReturnMapping
                 );
-        var filteredInvocation = Expression.Lambda<RouteHandlerFilterDelegate>(
+        var filteredInvocation = Expression.Lambda<EndpointFilterDelegate>(
             Expression.Condition(
                 Expression.GreaterThanOrEqual(FilterContextHttpContextStatusCodeExpr, Expression.Constant(400)),
                 CompletedValueTaskExpr,
                 handlerInvocation),
             FilterContextExpr).Compile();
-        var routeHandlerContext = new RouteHandlerContext(
+        var routeHandlerContext = new EndpointFilterFactoryContext(
             methodInfo,
             factoryContext.Metadata,
             factoryContext.ServiceProvider ?? EmptyServiceProvider.Instance);
@@ -428,16 +428,16 @@ public static partial class RequestDelegateFactory
         return ExecuteAwaited(task);
     }
 
-    private static Expression CreateRouteHandlerInvocationContextBase(FactoryContext factoryContext)
+    private static Expression CreateEndpointFilterInvocationContextBase(FactoryContext factoryContext)
     {
         // In the event that a constructor matching the arity of the
         // provided parameters is not found, we fall back to using the
-        // non-generic implementation of RouteHandlerInvocationContext.
+        // non-generic implementation of EndpointFilterInvocationContext.
         Expression paramArray = factoryContext.BoxedArgs.Length > 0
             ? Expression.NewArrayInit(typeof(object), factoryContext.BoxedArgs)
             : Expression.Call(ArrayEmptyOfObjectMethod);
         var fallbackConstruction = Expression.New(
-            DefaultRouteHandlerInvocationContextConstructor,
+            DefaultEndpointFilterInvocationContextConstructor,
             new Expression[] { HttpContextExpr, paramArray });
 
         if (!RuntimeFeature.IsDynamicCodeCompiled)
@@ -453,17 +453,17 @@ public static partial class RequestDelegateFactory
 
         var constructorType = factoryContext.ArgumentTypes?.Length switch
         {
-            1 => typeof(RouteHandlerInvocationContext<>),
-            2 => typeof(RouteHandlerInvocationContext<,>),
-            3 => typeof(RouteHandlerInvocationContext<,,>),
-            4 => typeof(RouteHandlerInvocationContext<,,,>),
-            5 => typeof(RouteHandlerInvocationContext<,,,,>),
-            6 => typeof(RouteHandlerInvocationContext<,,,,,>),
-            7 => typeof(RouteHandlerInvocationContext<,,,,,,>),
-            8 => typeof(RouteHandlerInvocationContext<,,,,,,,>),
-            9 => typeof(RouteHandlerInvocationContext<,,,,,,,,>),
-            10 => typeof(RouteHandlerInvocationContext<,,,,,,,,,>),
-            _ => typeof(DefaultRouteHandlerInvocationContext)
+            1 => typeof(EndpointFilterInvocationContext<>),
+            2 => typeof(EndpointFilterInvocationContext<,>),
+            3 => typeof(EndpointFilterInvocationContext<,,>),
+            4 => typeof(EndpointFilterInvocationContext<,,,>),
+            5 => typeof(EndpointFilterInvocationContext<,,,,>),
+            6 => typeof(EndpointFilterInvocationContext<,,,,,>),
+            7 => typeof(EndpointFilterInvocationContext<,,,,,,>),
+            8 => typeof(EndpointFilterInvocationContext<,,,,,,,>),
+            9 => typeof(EndpointFilterInvocationContext<,,,,,,,,>),
+            10 => typeof(EndpointFilterInvocationContext<,,,,,,,,,>),
+            _ => typeof(DefaultEndpointFilterInvocationContext)
         };
 
         if (constructorType.IsGenericType)
@@ -471,15 +471,15 @@ public static partial class RequestDelegateFactory
             var constructor = constructorType.MakeGenericType(factoryContext.ArgumentTypes!).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).SingleOrDefault();
             if (constructor == null)
             {
-                // new RouteHandlerInvocationContext(httpContext, (object)name_local, (object)int_local);
+                // new EndpointFilterInvocationContext(httpContext, (object)name_local, (object)int_local);
                 return fallbackConstruction;
             }
 
-            // new RouteHandlerInvocationContext<string, int>(httpContext, name_local, int_local);
+            // new EndpointFilterInvocationContext<string, int>(httpContext, name_local, int_local);
             return Expression.New(constructor, arguments);
         }
 
-        // new RouteHandlerInvocationContext(httpContext, (object)name_local, (object)int_local);
+        // new EndpointFilterInvocationContext(httpContext, (object)name_local, (object)int_local);
         return fallbackConstruction;
     }
 
@@ -564,11 +564,11 @@ public static partial class RequestDelegateFactory
                 if (RuntimeFeature.IsDynamicCodeSupported)
                 {
                     // Register expressions containing the boxed and unboxed variants
-                    // of the route handler's arguments for use in RouteHandlerInvocationContext
+                    // of the route handler's arguments for use in EndpointFilterInvocationContext
                     // construction and route handler invocation.
                     // context.GetArgument<string>(0)
                     // (string, name_local), (int, int_local)
-                    factoryContext.ContextArgAccess.Add(Expression.Call(FilterContextExpr, RouteHandlerInvocationContextGetArgument.MakeGenericMethod(parameters[i].ParameterType), Expression.Constant(i)));
+                    factoryContext.ContextArgAccess.Add(Expression.Call(FilterContextExpr, EndpointFilterInvocationContextGetArgument.MakeGenericMethod(parameters[i].ParameterType), Expression.Constant(i)));
                 }
                 else
                 {
@@ -2126,7 +2126,7 @@ public static partial class RequestDelegateFactory
         public Type[] ArgumentTypes { get; set; } = Array.Empty<Type>();
         public Expression[] ArgumentExpressions { get; set; } = Array.Empty<Expression>();
         public Expression[] BoxedArgs { get; set; } = Array.Empty<Expression>();
-        public List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>? FilterFactories { get; init; }
+        public List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>? FilterFactories { get; init; }
         public bool FilterFactoriesHaveRunWithoutModifyingPerRequestBehavior { get; set; }
 
         public List<ParameterInfo> Parameters { get; set; } = new();

+ 1 - 1
src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs

@@ -36,7 +36,7 @@ public sealed class RequestDelegateFactoryOptions
     /// <summary>
     /// The list of filters that must run in the pipeline for a given route handler.
     /// </summary>
-    public IReadOnlyList<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>? RouteHandlerFilterFactories { get; init; }
+    public IReadOnlyList<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>? EndpointFilterFactories { get; init; }
 
     /// <summary>
     /// The mutable initial endpoint metadata to add as part of the creation of the <see cref="RequestDelegateResult.RequestDelegate"/>. In most cases,

+ 21 - 21
src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs

@@ -4889,7 +4889,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -4921,7 +4921,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create((string name) => $"Hello, {name}!", new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -4963,7 +4963,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(methodInfo!, null, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5006,7 +5006,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         };
         var factoryResult = RequestDelegateFactory.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5043,7 +5043,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>() {
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>() {
                 (routeHandlerContext, next) => async (context) =>
                 {
                     if (context.HttpContext.Response.StatusCode == 400)
@@ -5089,7 +5089,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5137,7 +5137,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) =>
                 {
@@ -5192,7 +5192,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) =>
                 {
@@ -5243,7 +5243,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(PrintTodo, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5284,7 +5284,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5327,7 +5327,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5396,7 +5396,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5454,7 +5454,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5519,7 +5519,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5553,7 +5553,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5620,7 +5620,7 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
@@ -5656,11 +5656,11 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
-                    Assert.IsType<DefaultRouteHandlerInvocationContext>(context);
+                    Assert.IsType<DefaultEndpointFilterInvocationContext>(context);
                     Assert.Equal(11, context.Arguments.Count);
                     return await next(context);
                 }
@@ -5687,11 +5687,11 @@ public class RequestDelegateFactoryTests : LoggedTest
         // Act
         var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) => async (context) =>
                 {
-                    Assert.IsType<DefaultRouteHandlerInvocationContext>(context);
+                    Assert.IsType<DefaultEndpointFilterInvocationContext>(context);
                     Assert.Equal(0, context.Arguments.Count);
                     return await next(context);
                 }
@@ -6081,7 +6081,7 @@ public class RequestDelegateFactoryTests : LoggedTest
 
         RequestDelegateFactoryOptions options = new()
         {
-            RouteHandlerFilterFactories = new List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>()
+            EndpointFilterFactories = new List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>()
             {
                 (routeHandlerContext, next) =>
                 {

+ 24 - 25
src/Http/Routing/src/Builder/RouteHandlerFilterExtensions.cs → src/Http/Routing/src/Builder/EndpointFilterExtensions.cs

@@ -9,51 +9,50 @@ using Microsoft.Extensions.DependencyInjection;
 namespace Microsoft.AspNetCore.Http;
 
 /// <summary>
-/// Extension methods for adding <see cref="IRouteHandlerFilter"/> to a route handler.
+/// Extension methods for adding <see cref="IEndpointFilter"/> to a route handler.
 /// </summary>
-public static class RouteHandlerFilterExtensions
+public static class EndpointFilterExtensions
 {
     /// <summary>
     /// Registers a filter onto the route handler.
     /// </summary>
     /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
-    /// <param name="filter">The <see cref="IRouteHandlerFilter"/> to register.</param>
+    /// <param name="filter">The <see cref="IEndpointFilter"/> to register.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
-
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static TBuilder AddRouteHandlerFilter<TBuilder>(this TBuilder builder, IRouteHandlerFilter filter) where TBuilder : IEndpointConventionBuilder =>
-        builder.AddRouteHandlerFilter((routeHandlerContext, next) => (context) => filter.InvokeAsync(context, next));
+    public static TBuilder AddEndpointFilter<TBuilder>(this TBuilder builder, IEndpointFilter filter) where TBuilder : IEndpointConventionBuilder =>
+        builder.AddEndpointFilter((routeHandlerContext, next) => (context) => filter.InvokeAsync(context, next));
 
     /// <summary>
     /// Registers a filter of type <typeparamref name="TFilterType"/> onto the route handler.
     /// </summary>
     /// <typeparam name="TBuilder">The type of the <see cref="IEndpointConventionBuilder"/> to configure.</typeparam>
-    /// <typeparam name="TFilterType">The type of the <see cref="IRouteHandlerFilter"/> to register.</typeparam>
+    /// <typeparam name="TFilterType">The type of the <see cref="IEndpointFilter"/> to register.</typeparam>
     /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static TBuilder AddRouteHandlerFilter<TBuilder, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this TBuilder builder)
+    public static TBuilder AddEndpointFilter<TBuilder, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this TBuilder builder)
         where TBuilder : IEndpointConventionBuilder
-        where TFilterType : IRouteHandlerFilter
+        where TFilterType : IEndpointFilter
     {
         // We call `CreateFactory` twice here since the `CreateFactory` API does not support optional arguments.
         // See https://github.com/dotnet/runtime/issues/67309 for more info.
         ObjectFactory filterFactory;
         try
         {
-            filterFactory = ActivatorUtilities.CreateFactory(typeof(TFilterType), new[] { typeof(RouteHandlerContext) });
+            filterFactory = ActivatorUtilities.CreateFactory(typeof(TFilterType), new[] { typeof(EndpointFilterFactoryContext) });
         }
         catch (InvalidOperationException)
         {
             filterFactory = ActivatorUtilities.CreateFactory(typeof(TFilterType), Type.EmptyTypes);
         }
 
-        builder.AddRouteHandlerFilter((routeHandlerContext, next) =>
+        builder.AddEndpointFilter((routeHandlerContext, next) =>
         {
             var invokeArguments = new[] { routeHandlerContext };
             return (context) =>
             {
-                var filter = (IRouteHandlerFilter)filterFactory.Invoke(context.HttpContext.RequestServices, invokeArguments);
+                var filter = (IEndpointFilter)filterFactory.Invoke(context.HttpContext.RequestServices, invokeArguments);
                 return filter.InvokeAsync(context, next);
             };
         });
@@ -63,29 +62,29 @@ public static class RouteHandlerFilterExtensions
     /// <summary>
     /// Registers a filter of type <typeparamref name="TFilterType"/> onto the route handler.
     /// </summary>
-    /// <typeparam name="TFilterType">The type of the <see cref="IRouteHandlerFilter"/> to register.</typeparam>
+    /// <typeparam name="TFilterType">The type of the <see cref="IEndpointFilter"/> to register.</typeparam>
     /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static RouteHandlerBuilder AddRouteHandlerFilter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this RouteHandlerBuilder builder)
-        where TFilterType : IRouteHandlerFilter
+    public static RouteHandlerBuilder AddEndpointFilter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this RouteHandlerBuilder builder)
+        where TFilterType : IEndpointFilter
     {
         // We have a RouteHandlerBuiler and GroupRouteBuilder-specific AddFilter methods for convenience so you don't have to specify both arguments most the time.
-        return builder.AddRouteHandlerFilter<RouteHandlerBuilder, TFilterType>();
+        return builder.AddEndpointFilter<RouteHandlerBuilder, TFilterType>();
     }
 
     /// <summary>
     /// Registers a filter of type <typeparamref name="TFilterType"/> onto the route handler.
     /// </summary>
-    /// <typeparam name="TFilterType">The type of the <see cref="IRouteHandlerFilter"/> to register.</typeparam>
+    /// <typeparam name="TFilterType">The type of the <see cref="IEndpointFilter"/> to register.</typeparam>
     /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static RouteGroupBuilder AddRouteHandlerFilter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this RouteGroupBuilder builder)
-        where TFilterType : IRouteHandlerFilter
+    public static RouteGroupBuilder AddEndpointFilter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilterType>(this RouteGroupBuilder builder)
+        where TFilterType : IEndpointFilter
     {
         // We have a RouteHandlerBuiler and GroupRouteBuilder-specific AddFilter methods for convenience so you don't have to specify both arguments most the time.
-        return builder.AddRouteHandlerFilter<RouteGroupBuilder, TFilterType>();
+        return builder.AddEndpointFilter<RouteGroupBuilder, TFilterType>();
     }
 
     /// <summary>
@@ -95,10 +94,10 @@ public static class RouteHandlerFilterExtensions
     /// <param name="routeHandlerFilter">A method representing the core logic of the filter.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static TBuilder AddRouteHandlerFilter<TBuilder>(this TBuilder builder, Func<RouteHandlerInvocationContext, RouteHandlerFilterDelegate, ValueTask<object?>> routeHandlerFilter)
+    public static TBuilder AddEndpointFilter<TBuilder>(this TBuilder builder, Func<EndpointFilterInvocationContext, EndpointFilterDelegate, ValueTask<object?>> routeHandlerFilter)
         where TBuilder : IEndpointConventionBuilder
     {
-        return builder.AddRouteHandlerFilter((routeHandlerContext, next) => (context) => routeHandlerFilter(context, next));
+        return builder.AddEndpointFilter((routeHandlerContext, next) => (context) => routeHandlerFilter(context, next));
     }
 
     /// <summary>
@@ -108,7 +107,7 @@ public static class RouteHandlerFilterExtensions
     /// <param name="filterFactory">A method representing the logic for constructing the filter.</param>
     /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns>
     [RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
-    public static TBuilder AddRouteHandlerFilter<TBuilder>(this TBuilder builder, Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate> filterFactory)
+    public static TBuilder AddEndpointFilter<TBuilder>(this TBuilder builder, Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate> filterFactory)
         where TBuilder : IEndpointConventionBuilder
     {
         builder.Add(endpointBuilder =>
@@ -118,8 +117,8 @@ public static class RouteHandlerFilterExtensions
                 return;
             }
 
-            routeEndpointBuilder.RouteHandlerFilterFactories ??= new();
-            routeEndpointBuilder.RouteHandlerFilterFactories.Add(filterFactory);
+            routeEndpointBuilder.EndpointFilterFactories ??= new();
+            routeEndpointBuilder.EndpointFilterFactories.Add(filterFactory);
         });
 
         return builder;

+ 2 - 2
src/Http/Routing/src/CompositeEndpointDataSource.cs

@@ -76,7 +76,7 @@ public sealed class CompositeEndpointDataSource : EndpointDataSource, IDisposabl
     }
 
     /// <inheritdoc/>
-    public override IReadOnlyList<Endpoint> GetEndpointGroup(RouteGroupContext context)
+    public override IReadOnlyList<Endpoint> GetGroupedEndpoints(RouteGroupContext context)
     {
         if (_dataSources.Count is 0)
         {
@@ -90,7 +90,7 @@ public sealed class CompositeEndpointDataSource : EndpointDataSource, IDisposabl
 
         foreach (var dataSource in _dataSources)
         {
-            groupedEndpoints.AddRange(dataSource.GetEndpointGroup(context));
+            groupedEndpoints.AddRange(dataSource.GetGroupedEndpoints(context));
         }
 
         // There's no need to cache these the way we do with _endpoints. This is only ever used to get intermediate results.

+ 1 - 1
src/Http/Routing/src/EndpointDataSource.cs

@@ -32,7 +32,7 @@ public abstract class EndpointDataSource
     /// <returns>
     /// Returns a read-only collection of <see cref="Endpoint"/> instances given the specified group <see cref="RouteGroupContext.Prefix"/> and <see cref="RouteGroupContext.Conventions"/>.
     /// </returns>
-    public virtual IReadOnlyList<Endpoint> GetEndpointGroup(RouteGroupContext context)
+    public virtual IReadOnlyList<Endpoint> GetGroupedEndpoints(RouteGroupContext context)
     {
         // Only evaluate Endpoints once per call.
         var endpoints = Endpoints;

+ 9 - 9
src/Http/Routing/src/PublicAPI.Unshipped.txt

@@ -1,5 +1,5 @@
 #nullable enable
-Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions
+Microsoft.AspNetCore.Http.EndpointFilterExtensions
 Microsoft.AspNetCore.Routing.CompositeEndpointDataSource.Dispose() -> void
 Microsoft.AspNetCore.Routing.RouteGroupBuilder
 Microsoft.AspNetCore.Routing.RouteGroupContext
@@ -9,22 +9,22 @@ Microsoft.AspNetCore.Routing.RouteGroupContext.Prefix.get -> Microsoft.AspNetCor
 Microsoft.AspNetCore.Routing.RouteGroupContext.RouteGroupContext(Microsoft.AspNetCore.Routing.Patterns.RoutePattern! prefix, System.Collections.Generic.IReadOnlyList<System.Action<Microsoft.AspNetCore.Builder.EndpointBuilder!>!>! conventions, System.IServiceProvider! applicationServices) -> void
 Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy(string! token, System.Type! type) -> void
 Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy<T>(string! token) -> void
-override Microsoft.AspNetCore.Routing.CompositeEndpointDataSource.GetEndpointGroup(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.Endpoint!>!
+override Microsoft.AspNetCore.Routing.CompositeEndpointDataSource.GetGroupedEndpoints(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.Endpoint!>!
 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?
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TBuilder, TFilterType>(this TBuilder builder) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TBuilder>(this TBuilder builder, Microsoft.AspNetCore.Http.IEndpointFilter! filter) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TBuilder>(this TBuilder builder, System.Func<Microsoft.AspNetCore.Http.EndpointFilterFactoryContext!, Microsoft.AspNetCore.Http.EndpointFilterDelegate!, Microsoft.AspNetCore.Http.EndpointFilterDelegate!>! filterFactory) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TBuilder>(this TBuilder builder, System.Func<Microsoft.AspNetCore.Http.EndpointFilterInvocationContext!, Microsoft.AspNetCore.Http.EndpointFilterDelegate!, System.Threading.Tasks.ValueTask<object?>>! routeHandlerFilter) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TFilterType>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder! builder) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter<TFilterType>(this Microsoft.AspNetCore.Routing.RouteGroupBuilder! builder) -> Microsoft.AspNetCore.Routing.RouteGroupBuilder!
 static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.ExcludeFromDescription<TBuilder>(this TBuilder builder) -> TBuilder
 static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithDescription<TBuilder>(this TBuilder builder, string! description) -> TBuilder
 static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithSummary<TBuilder>(this TBuilder builder, string! summary) -> TBuilder
 static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithTags<TBuilder>(this TBuilder builder, params string![]! tags) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TBuilder, TFilterType>(this TBuilder builder) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TBuilder>(this TBuilder builder, Microsoft.AspNetCore.Http.IRouteHandlerFilter! filter) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TBuilder>(this TBuilder builder, System.Func<Microsoft.AspNetCore.Http.RouteHandlerContext!, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate!, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate!>! filterFactory) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TBuilder>(this TBuilder builder, System.Func<Microsoft.AspNetCore.Http.RouteHandlerInvocationContext!, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate!, System.Threading.Tasks.ValueTask<object?>>! routeHandlerFilter) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TFilterType>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder! builder) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter<TFilterType>(this Microsoft.AspNetCore.Routing.RouteGroupBuilder! builder) -> Microsoft.AspNetCore.Routing.RouteGroupBuilder!
 static Microsoft.AspNetCore.Routing.LinkGeneratorEndpointNameAddressExtensions.GetPathByName(this Microsoft.AspNetCore.Routing.LinkGenerator! generator, Microsoft.AspNetCore.Http.HttpContext! httpContext, string! endpointName, Microsoft.AspNetCore.Routing.RouteValueDictionary? values = null, Microsoft.AspNetCore.Http.PathString? pathBase = null, Microsoft.AspNetCore.Http.FragmentString fragment = default(Microsoft.AspNetCore.Http.FragmentString), Microsoft.AspNetCore.Routing.LinkOptions? options = null) -> string?
 static Microsoft.AspNetCore.Routing.LinkGeneratorEndpointNameAddressExtensions.GetPathByName(this Microsoft.AspNetCore.Routing.LinkGenerator! generator, string! endpointName, Microsoft.AspNetCore.Routing.RouteValueDictionary? values = null, Microsoft.AspNetCore.Http.PathString pathBase = default(Microsoft.AspNetCore.Http.PathString), Microsoft.AspNetCore.Http.FragmentString fragment = default(Microsoft.AspNetCore.Http.FragmentString), Microsoft.AspNetCore.Routing.LinkOptions? options = null) -> string?
 static Microsoft.AspNetCore.Routing.LinkGeneratorEndpointNameAddressExtensions.GetUriByName(this Microsoft.AspNetCore.Routing.LinkGenerator! generator, Microsoft.AspNetCore.Http.HttpContext! httpContext, string! endpointName, Microsoft.AspNetCore.Routing.RouteValueDictionary? values = null, string? scheme = null, Microsoft.AspNetCore.Http.HostString? host = null, Microsoft.AspNetCore.Http.PathString? pathBase = null, Microsoft.AspNetCore.Http.FragmentString fragment = default(Microsoft.AspNetCore.Http.FragmentString), Microsoft.AspNetCore.Routing.LinkOptions? options = null) -> string?
@@ -39,5 +39,5 @@ static Microsoft.AspNetCore.Routing.Patterns.RoutePatternFactory.Pattern(Microso
 static Microsoft.AspNetCore.Routing.Patterns.RoutePatternFactory.Pattern(Microsoft.AspNetCore.Routing.RouteValueDictionary? defaults, Microsoft.AspNetCore.Routing.RouteValueDictionary? parameterPolicies, params Microsoft.AspNetCore.Routing.Patterns.RoutePatternPathSegment![]! segments) -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern!
 static Microsoft.AspNetCore.Routing.Patterns.RoutePatternFactory.Pattern(string? rawText, Microsoft.AspNetCore.Routing.RouteValueDictionary? defaults, Microsoft.AspNetCore.Routing.RouteValueDictionary? parameterPolicies, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Routing.Patterns.RoutePatternPathSegment!>! segments) -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern!
 static Microsoft.AspNetCore.Routing.Patterns.RoutePatternFactory.Pattern(string? rawText, Microsoft.AspNetCore.Routing.RouteValueDictionary? defaults, Microsoft.AspNetCore.Routing.RouteValueDictionary? parameterPolicies, params Microsoft.AspNetCore.Routing.Patterns.RoutePatternPathSegment![]! segments) -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern!
-virtual Microsoft.AspNetCore.Routing.EndpointDataSource.GetEndpointGroup(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.Endpoint!>!
+virtual Microsoft.AspNetCore.Routing.EndpointDataSource.GetGroupedEndpoints(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Http.Endpoint!>!
 virtual Microsoft.AspNetCore.Routing.Patterns.RoutePatternTransformer.SubstituteRequiredValues(Microsoft.AspNetCore.Routing.Patterns.RoutePattern! original, Microsoft.AspNetCore.Routing.RouteValueDictionary! requiredValues) -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern?

+ 6 - 6
src/Http/Routing/src/RouteEndpointBuilder.cs

@@ -13,9 +13,9 @@ namespace Microsoft.AspNetCore.Routing;
 /// </summary>
 public sealed class RouteEndpointBuilder : EndpointBuilder
 {
-    // TODO: Make this public as a gettable IReadOnlyList<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>.
-    // AddRouteHandlerFilter will still be the only way to mutate this list.
-    internal List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>? RouteHandlerFilterFactories { get; set; }
+    // TODO: Make this public as a gettable IReadOnlyList<Func<RouteHandlerContext, EndpointFilterDelegate, EndpointFilterDelegate>>.
+    // AddEndpointFilter will still be the only way to mutate this list.
+    internal List<Func<EndpointFilterFactoryContext, EndpointFilterDelegate, EndpointFilterDelegate>>? EndpointFilterFactories { get; set; }
 
     /// <summary>
     /// Gets or sets the <see cref="RoutePattern"/> associated with this endpoint.
@@ -45,7 +45,7 @@ public sealed class RouteEndpointBuilder : EndpointBuilder
 
     /// <inheritdoc />
     [UnconditionalSuppressMessage("Trimmer", "IL2026",
-        Justification = "We surface a RequireUnreferencedCode in AddRouteHandlerFilter which is required to call unreferenced code here. The trimmer is unable to infer this.")]
+        Justification = "We surface a RequireUnreferencedCode in AddEndpointFilter which is required to call unreferenced code here. The trimmer is unable to infer this.")]
     public override Endpoint Build()
     {
         if (RequestDelegate is null)
@@ -60,14 +60,14 @@ public sealed class RouteEndpointBuilder : EndpointBuilder
         // ModelEndpointDataSource (Map(RoutePattern, RequestDelegate) and by extension MapHub, MapHealthChecks, etc...),
         // ActionEndpointDataSourceBase (MapControllers, MapRazorPages, etc...) and people with custom data sources or otherwise manually building endpoints
         // using this type. At the moment this class is sealed, so at the moment we do not need to concern ourselves with what derived types may be doing.
-        if (RouteHandlerFilterFactories is { Count: > 0 })
+        if (EndpointFilterFactories is { Count: > 0 })
         {
             // Even with filters applied, RDF.Create() will return back the exact same RequestDelegate instance we pass in if filters decide not to modify the
             // invocation pipeline. We're just passing in a RequestDelegate so none of the fancy options pertaining to how the Delegate parameters are handled
             // do not matter.
             RequestDelegateFactoryOptions rdfOptions = new()
             {
-                RouteHandlerFilterFactories = RouteHandlerFilterFactories,
+                EndpointFilterFactories = EndpointFilterFactories,
                 EndpointMetadata = Metadata,
             };
 

+ 3 - 3
src/Http/Routing/src/RouteEndpointDataSource.cs

@@ -58,7 +58,7 @@ internal sealed class RouteEndpointDataSource : EndpointDataSource
         }
     }
 
-    public override IReadOnlyList<RouteEndpoint> GetEndpointGroup(RouteGroupContext context)
+    public override IReadOnlyList<RouteEndpoint> GetGroupedEndpoints(RouteGroupContext context)
     {
         var endpoints = new RouteEndpoint[_routeEntries.Count];
         for (int i = 0; i < _routeEntries.Count; i++)
@@ -179,14 +179,14 @@ internal sealed class RouteEndpointDataSource : EndpointDataSource
             ThrowOnBadRequest = _throwOnBadRequest,
             DisableInferBodyFromParameters = ShouldDisableInferredBodyParameters(entry.HttpMethods),
             EndpointMetadata = builder.Metadata,
-            RouteHandlerFilterFactories = builder.RouteHandlerFilterFactories,
+            EndpointFilterFactories = builder.EndpointFilterFactories,
         };
 
         // We ignore the returned EndpointMetadata has been already populated since we passed in non-null EndpointMetadata.
         factoryCreatedRequestDelegate = RequestDelegateFactory.Create(entry.RouteHandler, factoryOptions).RequestDelegate;
 
         // Clear out any filters so they don't get rerun in Build(). We can rethink how we do this later when exposed as public API.
-        builder.RouteHandlerFilterFactories = null;
+        builder.EndpointFilterFactories = null;
 
         if (ReferenceEquals(builder.RequestDelegate, redirectedRequestDelegate))
         {

+ 3 - 3
src/Http/Routing/src/RouteGroupBuilder.cs

@@ -48,7 +48,7 @@ public sealed class RouteGroupBuilder : IEndpointRouteBuilder, IEndpointConventi
         public override IReadOnlyList<Endpoint> Endpoints =>
             GetGroupedEndpointsWithNullablePrefix(null, Array.Empty<Action<EndpointBuilder>>(), _routeGroupBuilder._outerEndpointRouteBuilder.ServiceProvider);
 
-        public override IReadOnlyList<Endpoint> GetEndpointGroup(RouteGroupContext context) =>
+        public override IReadOnlyList<Endpoint> GetGroupedEndpoints(RouteGroupContext context) =>
             GetGroupedEndpointsWithNullablePrefix(context.Prefix, context.Conventions, context.ApplicationServices);
 
         public IReadOnlyList<Endpoint> GetGroupedEndpointsWithNullablePrefix(RoutePattern? prefix, IReadOnlyList<Action<EndpointBuilder>> conventions, IServiceProvider applicationServices)
@@ -56,7 +56,7 @@ public sealed class RouteGroupBuilder : IEndpointRouteBuilder, IEndpointConventi
             return _routeGroupBuilder._dataSources.Count switch
             {
                 0 => Array.Empty<Endpoint>(),
-                1 => _routeGroupBuilder._dataSources[0].GetEndpointGroup(GetNextRouteGroupContext(prefix, conventions, applicationServices)),
+                1 => _routeGroupBuilder._dataSources[0].GetGroupedEndpoints(GetNextRouteGroupContext(prefix, conventions, applicationServices)),
                 _ => SelectEndpointsFromAllDataSources(GetNextRouteGroupContext(prefix, conventions, applicationServices)),
             };
         }
@@ -92,7 +92,7 @@ public sealed class RouteGroupBuilder : IEndpointRouteBuilder, IEndpointConventi
 
             foreach (var dataSource in _routeGroupBuilder._dataSources)
             {
-                groupedEndpoints.AddRange(dataSource.GetEndpointGroup(context));
+                groupedEndpoints.AddRange(dataSource.GetGroupedEndpoints(context));
             }
 
             return groupedEndpoints;

+ 3 - 3
src/Http/Routing/src/RouteGroupContext.cs

@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Routing.Patterns;
 namespace Microsoft.AspNetCore.Routing;
 
 /// <summary>
-/// Represents the information accessible to <see cref="EndpointDataSource.GetEndpointGroup(RouteGroupContext)"/>.
+/// Represents the information accessible to <see cref="EndpointDataSource.GetGroupedEndpoints(RouteGroupContext)"/>.
 /// </summary>
 public sealed class RouteGroupContext
 {
@@ -30,7 +30,7 @@ public sealed class RouteGroupContext
 
     /// <summary>
     /// Gets the <see cref="RouteEndpoint.RoutePattern"/> which should prefix the <see cref="RouteEndpoint.RoutePattern"/> of all <see cref="RouteEndpoint"/> instances
-    /// returned by the call to <see cref="EndpointDataSource.GetEndpointGroup(RouteGroupContext)"/>. This accounts for nested groups and gives the full group prefix
+    /// returned by the call to <see cref="EndpointDataSource.GetGroupedEndpoints(RouteGroupContext)"/>. This accounts for nested groups and gives the full group prefix
     /// not just the prefix supplied to the innermost call to <see cref="EndpointRouteBuilderExtensions.MapGroup(IEndpointRouteBuilder, RoutePattern)"/>.
     /// </summary>
     public RoutePattern Prefix { get; }
@@ -38,7 +38,7 @@ public sealed class RouteGroupContext
     /// <summary>
     /// Gets all conventions added to ancestor <see cref="RouteGroupBuilder"/> instances returned from <see cref="EndpointRouteBuilderExtensions.MapGroup(IEndpointRouteBuilder, RoutePattern)"/>
     /// via <see cref="IEndpointConventionBuilder.Add(Action{EndpointBuilder})"/>. These should be applied in order when building every <see cref="RouteEndpoint"/>
-    /// returned from <see cref="EndpointDataSource.GetEndpointGroup(RouteGroupContext)"/>.
+    /// returned from <see cref="EndpointDataSource.GetGroupedEndpoints(RouteGroupContext)"/>.
     /// </summary>
     public IReadOnlyList<Action<EndpointBuilder>> Conventions { get; }
 

+ 3 - 3
src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs

@@ -109,7 +109,7 @@ public class RequestDelegateEndpointRouteBuilderExtensionsTest
 
     [Theory]
     [MemberData(nameof(MapMethods))]
-    public async Task MapEndpoint_CanBeFiltered_ByRouteHandlerFilters(Func<IEndpointRouteBuilder, string, RequestDelegate, IEndpointConventionBuilder> map)
+    public async Task MapEndpoint_CanBeFiltered_ByEndpointFilters(Func<IEndpointRouteBuilder, string, RequestDelegate, IEndpointConventionBuilder> map)
     {
         var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(EmptyServiceProvider.Instance));
         var httpContext = new DefaultHttpContext();
@@ -119,7 +119,7 @@ public class RequestDelegateEndpointRouteBuilderExtensionsTest
         RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
         var filterTag = new TagsAttribute("filter");
 
-        var endpointBuilder = map(builder, "/", initialRequestDelegate).AddRouteHandlerFilter(filterFactory: (routeHandlerContext, next) =>
+        var endpointBuilder = map(builder, "/", initialRequestDelegate).AddEndpointFilter(filterFactory: (routeHandlerContext, next) =>
         {
             routeHandlerContext.EndpointMetadata.Add(filterTag);
             return async invocationContext =>
@@ -155,7 +155,7 @@ public class RequestDelegateEndpointRouteBuilderExtensionsTest
         RequestDelegate initialRequestDelegate = static (context) => Task.CompletedTask;
         var filterTag = new TagsAttribute("filter");
 
-        var endpointBuilder = map(builder, "/", initialRequestDelegate).AddRouteHandlerFilter((routeHandlerContext, next) =>
+        var endpointBuilder = map(builder, "/", initialRequestDelegate).AddEndpointFilter((routeHandlerContext, next) =>
         {
             routeHandlerContext.EndpointMetadata.Add(filterTag);
             return next;

+ 18 - 18
src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs

@@ -851,8 +851,8 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
 
     public static object[][] AddFiltersByClassData =
     {
-        new object[] { (Action<IEndpointConventionBuilder>)((IEndpointConventionBuilder builder) => builder.AddRouteHandlerFilter(new IncrementArgFilter())) },
-        new object[] { (Action<IEndpointConventionBuilder>)((IEndpointConventionBuilder builder) => builder.AddRouteHandlerFilter<IEndpointConventionBuilder, IncrementArgFilter>()) }
+        new object[] { (Action<IEndpointConventionBuilder>)((IEndpointConventionBuilder builder) => builder.AddEndpointFilter(new IncrementArgFilter())) },
+        new object[] { (Action<IEndpointConventionBuilder>)((IEndpointConventionBuilder builder) => builder.AddEndpointFilter<IEndpointConventionBuilder, IncrementArgFilter>()) }
     };
 
     public static object[][] AddFiltersByDelegateData
@@ -860,14 +860,14 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
         get
         {
             void WithFilter(IEndpointConventionBuilder builder) =>
-                builder.AddRouteHandlerFilter(async (context, next) =>
+                builder.AddEndpointFilter(async (context, next) =>
                 {
                     context.Arguments[0] = ((int)context.Arguments[0]!) + 1;
                     return await next(context);
                 });
 
             void WithFilterFactory(IEndpointConventionBuilder builder) =>
-                builder.AddRouteHandlerFilter((routeHandlerContext, next) => async (context) =>
+                builder.AddEndpointFilter((routeHandlerContext, next) => async (context) =>
                 {
                     Assert.NotNull(routeHandlerContext.MethodInfo);
                     Assert.NotNull(routeHandlerContext.MethodInfo.DeclaringType);
@@ -908,7 +908,7 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
     [Theory]
     [MemberData(nameof(AddFiltersByClassData))]
     [MemberData(nameof(AddFiltersByDelegateData))]
-    public async Task AddRouteHandlerFilterMethods_CanRegisterFilterWithClassAndDelegateImplementations(Action<IEndpointConventionBuilder> addFilter)
+    public async Task AddEndpointFilterMethods_CanRegisterFilterWithClassAndDelegateImplementations(Action<IEndpointConventionBuilder> addFilter)
     {
         var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()));
 
@@ -924,7 +924,7 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
     [Theory]
     [MemberData(nameof(AddFiltersByClassData))]
     [MemberData(nameof(AddFiltersByDelegateData))]
-    public async Task AddRouteHandlerFilterMethods_WorkWithMapGroup(Action<IEndpointConventionBuilder> addFilter)
+    public async Task AddEndpointFilterMethods_WorkWithMapGroup(Action<IEndpointConventionBuilder> addFilter)
     {
         var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()));
 
@@ -958,7 +958,7 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
 
         string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}";
         var routeHandlerBuilder = builder.Map("/", PrintLogger);
-        routeHandlerBuilder.AddRouteHandlerFilter<ServiceAccessingRouteHandlerFilter>();
+        routeHandlerBuilder.AddEndpointFilter<ServiceAccessingEndpointFilter>();
 
         var dataSource = GetBuilderEndpointDataSource(builder);
         // Trigger Endpoint build by calling getter.
@@ -991,7 +991,7 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
 
         string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}";
         var routeHandlerBuilder = builder.Map("/", PrintLogger);
-        routeHandlerBuilder.AddRouteHandlerFilter((rhc, next) =>
+        routeHandlerBuilder.AddEndpointFilter((rhc, next) =>
         {
             Assert.NotNull(rhc.ApplicationServices);
             var myService = rhc.ApplicationServices.GetRequiredService<MyService>();
@@ -1009,37 +1009,37 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
     [Fact]
     public void RouteHandlerContext_ThrowsArgumentNullException_ForMethodInfo()
     {
-        Assert.Throws<ArgumentNullException>("methodInfo", () => new RouteHandlerContext(null!, new List<object>(), new ServiceCollection().BuildServiceProvider()));
+        Assert.Throws<ArgumentNullException>("methodInfo", () => new EndpointFilterFactoryContext(null!, new List<object>(), new ServiceCollection().BuildServiceProvider()));
     }
 
     [Fact]
     public void RouteHandlerContext_ThrowsArgumentNullException_ForEndpointMetadata()
     {
         var handler = () => { };
-        Assert.Throws<ArgumentNullException>("endpointMetadata", () => new RouteHandlerContext(handler.Method, null!, new ServiceCollection().BuildServiceProvider()));
+        Assert.Throws<ArgumentNullException>("endpointMetadata", () => new EndpointFilterFactoryContext(handler.Method, null!, new ServiceCollection().BuildServiceProvider()));
     }
 
     [Fact]
     public void RouteHandlerContext_ThrowsArgumentNullException_ForApplicationServices()
     {
         var handler = () => { };
-        Assert.Throws<ArgumentNullException>("applicationServices", () => new RouteHandlerContext(handler.Method, new List<object>(), null!));
+        Assert.Throws<ArgumentNullException>("applicationServices", () => new EndpointFilterFactoryContext(handler.Method, new List<object>(), null!));
     }
 
     class MyService { }
 
-    class ServiceAccessingRouteHandlerFilter : IRouteHandlerFilter
+    class ServiceAccessingEndpointFilter : IEndpointFilter
     {
         private ILogger _logger;
-        private RouteHandlerContext _routeHandlerContext;
+        private EndpointFilterFactoryContext _routeHandlerContext;
 
-        public ServiceAccessingRouteHandlerFilter(ILoggerFactory loggerFactory, RouteHandlerContext routeHandlerContext)
+        public ServiceAccessingEndpointFilter(ILoggerFactory loggerFactory, EndpointFilterFactoryContext routeHandlerContext)
         {
-            _logger = loggerFactory.CreateLogger<ServiceAccessingRouteHandlerFilter>();
+            _logger = loggerFactory.CreateLogger<ServiceAccessingEndpointFilter>();
             _routeHandlerContext = routeHandlerContext;
         }
 
-        public async ValueTask<object?> InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next)
+        public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)
         {
             context.HttpContext.Items["loggerErrorIsEnabled"] = _logger.IsEnabled(LogLevel.Error);
             context.HttpContext.Items["parentName"] = _routeHandlerContext.MethodInfo.DeclaringType?.Name;
@@ -1047,9 +1047,9 @@ public class RouteHandlerEndpointRouteBuilderExtensionsTest : LoggedTest
         }
     }
 
-    class IncrementArgFilter : IRouteHandlerFilter
+    class IncrementArgFilter : IEndpointFilter
     {
-        public async ValueTask<object?> InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next)
+        public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)
         {
             context.Arguments[0] = ((int)context.Arguments[0]!) + 1;
             return await next(context);

+ 4 - 4
src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs

@@ -43,7 +43,7 @@ public class CompositeEndpointDataSourceTest
         var conventions = Array.Empty<Action<EndpointBuilder>>();
         var applicationServices = new ServiceCollection().BuildServiceProvider();
 
-        var groupedEndpoints = compositeDataSource.GetEndpointGroup(new RouteGroupContext(prefix, conventions, applicationServices));
+        var groupedEndpoints = compositeDataSource.GetGroupedEndpoints(new RouteGroupContext(prefix, conventions, applicationServices));
 
         var resolvedGroupEndpoints = Assert.Single(dataSource.ResolvedGroupedEndpoints);
         Assert.NotSame(groupedEndpoints, resolvedGroupEndpoints);
@@ -264,7 +264,7 @@ public class CompositeEndpointDataSourceTest
         };
 
         var context = new RouteGroupContext(prefix, conventions, applicationServices);
-        var groupedEndpoints = compositeDataSource.GetEndpointGroup(context);
+        var groupedEndpoints = compositeDataSource.GetGroupedEndpoints(context);
 
         var receivedContext = Assert.Single(dataSource.ReceivedRouteGroupContexts);
         Assert.Same(context, receivedContext);
@@ -299,10 +299,10 @@ public class CompositeEndpointDataSourceTest
 
         public List<IReadOnlyList<Endpoint>> ResolvedGroupedEndpoints { get; } = new();
 
-        public override IReadOnlyList<Endpoint> GetEndpointGroup(RouteGroupContext context)
+        public override IReadOnlyList<Endpoint> GetGroupedEndpoints(RouteGroupContext context)
         {
             ReceivedRouteGroupContexts.Add(context);
-            var resolved = base.GetEndpointGroup(context);
+            var resolved = base.GetGroupedEndpoints(context);
             ResolvedGroupedEndpoints.Add(resolved);
             return resolved;
         }

+ 2 - 2
src/Http/samples/MinimalSample/Program.cs

@@ -21,7 +21,7 @@ app.MapGet("/", () => $"""
 var outer = app.MapGroup("/outer");
 var inner = outer.MapGroup("/inner");
 
-inner.AddRouteHandlerFilter((routeContext, next) =>
+inner.AddEndpointFilter((routeContext, next) =>
 {
     var tags = routeContext.EndpointMetadata.OfType<ITagsMetadata>().FirstOrDefault();
 
@@ -36,7 +36,7 @@ inner.AddRouteHandlerFilter((routeContext, next) =>
 outer.MapGet("/outerget", () => "I'm nested.");
 inner.MapGet("/innerget", () => "I'm more nested.");
 
-inner.AddRouteHandlerFilter((routeContext, next) =>
+inner.AddEndpointFilter((routeContext, next) =>
 {
     Console.WriteLine($"Building filter! Num args: {routeContext.MethodInfo.GetParameters().Length}"); ;
     return async invocationContext =>