diff --git a/AspNetCore.sln b/AspNetCore.sln
index 849a91e6cc85..39377ea10e34 100644
--- a/AspNetCore.sln
+++ b/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}
diff --git a/src/Http/Http.Abstractions/src/DefaultRouteHandlerInvocationContext.cs b/src/Http/Http.Abstractions/src/DefaultEndpointFilterInvocationContext.cs
similarity index 75%
rename from src/Http/Http.Abstractions/src/DefaultRouteHandlerInvocationContext.cs
rename to src/Http/Http.Abstractions/src/DefaultEndpointFilterInvocationContext.cs
index e20f24678041..bc26cc1e02f0 100644
--- a/src/Http/Http.Abstractions/src/DefaultRouteHandlerInvocationContext.cs
+++ b/src/Http/Http.Abstractions/src/DefaultEndpointFilterInvocationContext.cs
@@ -7,14 +7,14 @@ namespace Microsoft.AspNetCore.Http;
/// Provides a default implementation for wrapping the and parameters
/// provided to a route handler.
///
-public sealed class DefaultRouteHandlerInvocationContext : RouteHandlerInvocationContext
+public sealed class DefaultEndpointFilterInvocationContext : EndpointFilterInvocationContext
{
///
- /// Creates a new instance of the for a given request.
+ /// Creates a new instance of the for a given request.
///
/// The associated with the current request.
/// A list of parameters provided in the current request.
- public DefaultRouteHandlerInvocationContext(HttpContext httpContext, params object[] arguments)
+ public DefaultEndpointFilterInvocationContext(HttpContext httpContext, params object[] arguments)
{
HttpContext = httpContext;
Arguments = arguments;
diff --git a/src/Http/Http.Abstractions/src/RouteHandlerFilterDelegate.cs b/src/Http/Http.Abstractions/src/EndpointFilterDelegate.cs
similarity index 65%
rename from src/Http/Http.Abstractions/src/RouteHandlerFilterDelegate.cs
rename to src/Http/Http.Abstractions/src/EndpointFilterDelegate.cs
index afc443a33a7d..d473cd52e7c7 100644
--- a/src/Http/Http.Abstractions/src/RouteHandlerFilterDelegate.cs
+++ b/src/Http/Http.Abstractions/src/EndpointFilterDelegate.cs
@@ -6,8 +6,8 @@ namespace Microsoft.AspNetCore.Http;
///
/// A delegate that is applied as a filter on a route handler.
///
-/// The associated with the current request.
+/// The associated with the current request.
///
/// A result of calling the handler and applying any modifications made by filters in the pipeline.
///
-public delegate ValueTask RouteHandlerFilterDelegate(RouteHandlerInvocationContext context);
+public delegate ValueTask EndpointFilterDelegate(EndpointFilterInvocationContext context);
diff --git a/src/Http/Http.Abstractions/src/RouteHandlerContext.cs b/src/Http/Http.Abstractions/src/EndpointFilterFactoryContext.cs
similarity index 86%
rename from src/Http/Http.Abstractions/src/RouteHandlerContext.cs
rename to src/Http/Http.Abstractions/src/EndpointFilterFactoryContext.cs
index f5c1f044955f..86ab54683508 100644
--- a/src/Http/Http.Abstractions/src/RouteHandlerContext.cs
+++ b/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.
///
-public sealed class RouteHandlerContext
+public sealed class EndpointFilterFactoryContext
{
///
- /// Creates a new instance of the .
+ /// Creates a new instance of the .
///
/// The associated with the route handler of the current request.
/// The associated with the endpoint the filter is targeting.
/// The instance used to access the application services.
- public RouteHandlerContext(MethodInfo methodInfo, IList endpointMetadata, IServiceProvider applicationServices)
+ public EndpointFilterFactoryContext(MethodInfo methodInfo, IList endpointMetadata, IServiceProvider applicationServices)
{
ArgumentNullException.ThrowIfNull(methodInfo);
ArgumentNullException.ThrowIfNull(endpointMetadata);
diff --git a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContext.cs b/src/Http/Http.Abstractions/src/EndpointFilterInvocationContext.cs
similarity index 95%
rename from src/Http/Http.Abstractions/src/RouteHandlerInvocationContext.cs
rename to src/Http/Http.Abstractions/src/EndpointFilterInvocationContext.cs
index 2ed6755fdab6..f372b08b1d72 100644
--- a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContext.cs
+++ b/src/Http/Http.Abstractions/src/EndpointFilterInvocationContext.cs
@@ -7,7 +7,7 @@ namespace Microsoft.AspNetCore.Http;
/// Provides an abstraction for wrapping the and arguments
/// provided to a route handler.
///
-public abstract class RouteHandlerInvocationContext
+public abstract class EndpointFilterInvocationContext
{
///
/// The associated with the current request being processed by the filter.
diff --git a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.cs b/src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.cs
similarity index 92%
rename from src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.cs
rename to src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.cs
index da7dd32ea3e4..b269cd9893eb 100644
--- a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.cs
+++ b/src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.cs
@@ -9,9 +9,9 @@
namespace Microsoft.AspNetCore.Http;
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0)
+ internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0)
{
HttpContext = httpContext;
Arg0 = arg0;
@@ -115,9 +115,9 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- internal RouteHandlerInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1)
+ internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1)
{
HttpContext = httpContext;
Arg0 = arg0;
@@ -228,9 +228,9 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
[GeneratedCode("TextTemplatingFileGenerator", "")]
-internal sealed class RouteHandlerInvocationContext : RouteHandlerInvocationContext, IList
+internal sealed class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList
{
- 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;
diff --git a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.tt b/src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.tt
similarity index 86%
rename from src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.tt
rename to src/Http/Http.Abstractions/src/EndpointFilterInvocationContextOfT.Generated.tt
index 6fcbe7075cde..098d6397318f 100644
--- a/src/Http/Http.Abstractions/src/RouteHandlerInvocationContextOfT.Generated.tt
+++ b/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
+internal sealed class EndpointFilterInvocationContext<<# foreach (var argumentCount in Enumerable.Range(0, arity)) { #>T<#=argumentCount#><# if (argumentCount < arity - 1) { #>, <# } #><# } #>> : EndpointFilterInvocationContext, IList
{
- 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#>;
diff --git a/src/Http/Http.Abstractions/src/IRouteHandlerFilter.cs b/src/Http/Http.Abstractions/src/IEndpointFilter.cs
similarity index 66%
rename from src/Http/Http.Abstractions/src/IRouteHandlerFilter.cs
rename to src/Http/Http.Abstractions/src/IEndpointFilter.cs
index 854947c4b351..7cd316ab00b5 100644
--- a/src/Http/Http.Abstractions/src/IRouteHandlerFilter.cs
+++ b/src/Http/Http.Abstractions/src/IEndpointFilter.cs
@@ -6,15 +6,15 @@ namespace Microsoft.AspNetCore.Http;
///
/// Provides an interface for implementing a filter targetting a route handler.
///
-public interface IRouteHandlerFilter
+public interface IEndpointFilter
{
///
- /// Implements the core logic associated with the filter given a
+ /// Implements the core logic associated with the filter given a
/// and the next filter to call in the pipeline.
///
- /// The associated with the current request/response.
+ /// The associated with the current request/response.
/// The next filter in the pipeline.
/// An awaitable result of calling the handler and apply
/// any modifications made by filters in the pipeline.
- ValueTask InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next);
+ ValueTask InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next);
}
diff --git a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
index 4c75d68b0ea1..dc51c9a2f0af 100644
--- a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
+++ b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
@@ -34,9 +34,9 @@ Microsoft.AspNetCore.Http.HttpResponse
-
+
TextTemplatingFileGenerator
- RouteHandlerInvocationContextOfT.Generated.cs
+ EndpointFilterInvocationContextOfT.Generated.cs
@@ -45,10 +45,10 @@ Microsoft.AspNetCore.Http.HttpResponse
-
+
True
True
- RouteHandlerInvocationContextOfT.Generated.tt
+ EndpointFilterInvocationContextOfT.Generated.tt
diff --git a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt b/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt
index 4a603bcbfc1c..2ead7210c54b 100644
--- a/src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt
+++ b/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!
+abstract Microsoft.AspNetCore.Http.EndpointFilterInvocationContext.GetArgument(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!
-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! endpointMetadata, System.IServiceProvider! applicationServices) -> void
+Microsoft.AspNetCore.Http.EndpointFilterFactoryContext.EndpointMetadata.get -> System.Collections.Generic.IList!
+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!
Microsoft.AspNetCore.Http.IBindableFromHttpContext
Microsoft.AspNetCore.Http.IBindableFromHttpContext.BindAsync(Microsoft.AspNetCore.Http.HttpContext! context, System.Reflection.ParameterInfo! parameter) -> System.Threading.Tasks.ValueTask
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
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
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!
-Microsoft.AspNetCore.Http.RouteHandlerContext.MethodInfo.get -> System.Reflection.MethodInfo!
-Microsoft.AspNetCore.Http.RouteHandlerContext.RouteHandlerContext(System.Reflection.MethodInfo! methodInfo, System.Collections.Generic.IList! 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>? values) -> void
Microsoft.AspNetCore.Routing.RouteValueDictionary.RouteValueDictionary(System.Collections.Generic.IEnumerable>? 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!
-abstract Microsoft.AspNetCore.Http.RouteHandlerInvocationContext.GetArgument(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!
-override Microsoft.AspNetCore.Http.DefaultRouteHandlerInvocationContext.GetArgument(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!
+override Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.GetArgument(int index) -> T
+override Microsoft.AspNetCore.Http.DefaultEndpointFilterInvocationContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!
diff --git a/src/Http/Http.Abstractions/test/RouteHandlerInvocationContextOfTTests.cs b/src/Http/Http.Abstractions/test/EndpointFilterInvocationContextOfTTests.cs
similarity index 71%
rename from src/Http/Http.Abstractions/test/RouteHandlerInvocationContextOfTTests.cs
rename to src/Http/Http.Abstractions/test/EndpointFilterInvocationContextOfTTests.cs
index f42f8d53c580..592a8cc0fc17 100644
--- a/src/Http/Http.Abstractions/test/RouteHandlerInvocationContextOfTTests.cs
+++ b/src/Http/Http.Abstractions/test/EndpointFilterInvocationContextOfTTests.cs
@@ -4,12 +4,12 @@
namespace Microsoft.AspNetCore.Http.Abstractions.Tests;
-public class RouteHandlerInvocationContextOfTTests
+public class EndpointFilterInvocationContextOfTTests
{
[Fact]
public void ProhibitsActionsThatModifyListSize()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), "This is a test", 42, false);
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), "This is a test", 42, false);
Assert.Throws(() => context.Add("string"));
Assert.Throws(() => context.Insert(0, "string"));
Assert.Throws(() => context.RemoveAt(0));
@@ -20,7 +20,7 @@ public void ProhibitsActionsThatModifyListSize()
[Fact]
public void ThrowsExceptionForInvalidCastOnGetArgument()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
Assert.Throws(() => context.GetArgument(1));
Assert.Throws(() => context.GetArgument(0));
Assert.Throws(() => context.GetArgument(3));
@@ -31,7 +31,7 @@ public void ThrowsExceptionForInvalidCastOnGetArgument()
[Fact]
public void SetterAllowsInPlaceModificationOfParameters()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
context[0] = "Foo";
Assert.Equal("Foo", context.GetArgument(0));
}
@@ -39,14 +39,14 @@ public void SetterAllowsInPlaceModificationOfParameters()
[Fact]
public void SetterDoesNotAllowModificationOfParameterType()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
Assert.Throws(() => context[0] = 4);
}
[Fact]
public void AllowsEnumerationOfParameters()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), "This is a test", 42, false, new Todo());
var enumeratedCount = 0;
foreach (var parameter in context)
{
@@ -60,7 +60,7 @@ public void AllowsEnumerationOfParameters()
[Fact]
public void HandlesMismatchedNullabilityOnTypeParams()
{
- var context = new RouteHandlerInvocationContext(new DefaultHttpContext(), null, null, null, null);
+ var context = new EndpointFilterInvocationContext(new DefaultHttpContext(), null, null, null, null);
// Mismatched reference types will resolve as null
Assert.Null(context.GetArgument(0));
Assert.Null(context.GetArgument(3));
@@ -72,8 +72,8 @@ public void HandlesMismatchedNullabilityOnTypeParams()
[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));
diff --git a/src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj b/src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj
index f35cfb3b4398..563e3cd7585b 100644
--- a/src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj
+++ b/src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj
@@ -16,9 +16,9 @@
-
-
-
+
+
+
diff --git a/src/Http/Http.Extensions/src/PublicAPI.Unshipped.txt b/src/Http/Http.Extensions/src/PublicAPI.Unshipped.txt
index 5b917e83875b..00c713fbc424 100644
--- a/src/Http/Http.Extensions/src/PublicAPI.Unshipped.txt
+++ b/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!>?
+Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointFilterFactories.init -> void
Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointMetadata.get -> System.Collections.Generic.IList?
Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.EndpointMetadata.init -> void
-Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions.RouteHandlerFilterFactories.get -> System.Collections.Generic.IReadOnlyList!>?
-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
static Microsoft.AspNetCore.Http.HttpRequestJsonExtensions.ReadFromJsonAsync(this Microsoft.AspNetCore.Http.HttpRequest! request, System.Text.Json.Serialization.Metadata.JsonTypeInfo! jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask
diff --git a/src/Http/Http.Extensions/src/RequestDelegateFactory.cs b/src/Http/Http.Extensions/src/RequestDelegateFactory.cs
index 5c1213d0fbb1..d27ca2442cc0 100644
--- a/src/Http/Http.Extensions/src/RequestDelegateFactory.cs
+++ b/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).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 @@ private static FactoryContext CreateFactoryContext(RequestDelegateFactoryOptions
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(),
};
}
@@ -252,7 +252,7 @@ private static IReadOnlyList AsReadOnlyList(IList metadata)
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 @@ private static IReadOnlyList AsReadOnlyList(IList metadata)
if (filterPipeline is not null)
{
- Expression>> invokePipeline = (context) => filterPipeline(context);
+ Expression>> invokePipeline = (context) => filterPipeline(context);
returnType = typeof(ValueTask);
- // var filterContext = new RouteHandlerInvocationContext(httpContext, name_local, int_local);
+ // var filterContext = new EndpointFilterInvocationContext(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 @@ private static IReadOnlyList AsReadOnlyList(IList metadata)
return HandleRequestBodyAndCompileRequestDelegate(responseWritingMethodCall, factoryContext);
}
- private static RouteHandlerFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, FactoryContext factoryContext, Expression>? targetFactory)
+ private static EndpointFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, FactoryContext factoryContext, Expression>? targetFactory)
{
Debug.Assert(factoryContext.FilterFactories is not null);
// httpContext.Response.StatusCode >= 400
@@ -314,10 +314,10 @@ private static IReadOnlyList AsReadOnlyList(IList metadata)
// When `handler` returns an object, we generate the following wrapper
// to convert it to `ValueTask` as expected in the filter
// pipeline.
- // ValueTask.FromResult(handler(RouteHandlerInvocationContext.GetArgument(0), RouteHandlerInvocationContext.GetArgument(1)));
+ // ValueTask.FromResult(handler(EndpointFilterInvocationContext.GetArgument(0), EndpointFilterInvocationContext.GetArgument(1)));
// When the `handler` is a generic Task or ValueTask we await the task and
// create a `ValueTask from the resulting value.
- // new ValueTask(await handler(RouteHandlerInvocationContext.GetArgument(0), RouteHandlerInvocationContext.GetArgument(1)));
+ // new ValueTask(await handler(EndpointFilterInvocationContext.GetArgument(0), EndpointFilterInvocationContext.GetArgument(1)));
// When the `handler` returns a void or a void-returning Task, then we return an EmptyHttpResult
// to as a ValueTask
// }
@@ -333,13 +333,13 @@ targetExpression is null
: Expression.Assign(TargetExpr, Expression.Invoke(targetFactory, FilterContextHttpContextExpr)),
handlerReturnMapping
);
- var filteredInvocation = Expression.Lambda(
+ var filteredInvocation = Expression.Lambda(
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 @@ private static Expression MapHandlerReturnTypeToValueTask(Expression methodCall,
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 @@ private static Expression CreateRouteHandlerInvocationContextBase(FactoryContext
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 @@ private static Expression CreateRouteHandlerInvocationContextBase(FactoryContext
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(httpContext, name_local, int_local);
+ // new EndpointFilterInvocationContext(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 @@ private static Expression[] CreateArguments(ParameterInfo[]? parameters, Factory
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(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 @@ private sealed class FactoryContext
public Type[] ArgumentTypes { get; set; } = Array.Empty();
public Expression[] ArgumentExpressions { get; set; } = Array.Empty();
public Expression[] BoxedArgs { get; set; } = Array.Empty();
- public List>? FilterFactories { get; init; }
+ public List>? FilterFactories { get; init; }
public bool FilterFactoriesHaveRunWithoutModifyingPerRequestBehavior { get; set; }
public List Parameters { get; set; } = new();
diff --git a/src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs b/src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs
index 58e5d5041a9b..a3f05d9db8a3 100644
--- a/src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs
+++ b/src/Http/Http.Extensions/src/RequestDelegateFactoryOptions.cs
@@ -36,7 +36,7 @@ public sealed class RequestDelegateFactoryOptions
///
/// The list of filters that must run in the pipeline for a given route handler.
///
- public IReadOnlyList>? RouteHandlerFilterFactories { get; init; }
+ public IReadOnlyList>? EndpointFilterFactories { get; init; }
///
/// The mutable initial endpoint metadata to add as part of the creation of the . In most cases,
diff --git a/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs b/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
index c25a8ec7de91..8b877f6a6cd2 100644
--- a/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
+++ b/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
@@ -4889,7 +4889,7 @@ string HelloName(string name)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -4921,7 +4921,7 @@ public async Task RequestDelegateFactory_InvokesFilters_OnDelegateWithTarget()
// Act
var factoryResult = RequestDelegateFactory.Create((string name) => $"Hello, {name}!", new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -4963,7 +4963,7 @@ public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithNullTarg
// Act
var factoryResult = RequestDelegateFactory.Create(methodInfo!, null, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5006,7 +5006,7 @@ public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithProvided
};
var factoryResult = RequestDelegateFactory.Create(methodInfo!, targetFactory, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5043,7 +5043,7 @@ string HelloName(string name)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>() {
+ EndpointFilterFactories = new List>() {
(routeHandlerContext, next) => async (context) =>
{
if (context.HttpContext.Response.StatusCode == 400)
@@ -5089,7 +5089,7 @@ string HelloName(string name, int age)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5137,7 +5137,7 @@ string HelloName(string name)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) =>
{
@@ -5192,7 +5192,7 @@ string HelloName(IFormFileCollection formFiles)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) =>
{
@@ -5243,7 +5243,7 @@ string PrintTodo(Todo todo)
// Act
var factoryResult = RequestDelegateFactory.Create(PrintTodo, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5284,7 +5284,7 @@ string HelloName(string name)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5327,7 +5327,7 @@ string HelloName(string name)
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5396,7 +5396,7 @@ public async Task CanInvokeFilter_OnTaskOfTReturningHandler(Delegate @delegate)
// Act
var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5454,7 +5454,7 @@ public async Task CanInvokeFilter_OnValueTaskOfTReturningHandler(Delegate @deleg
// Act
var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5519,7 +5519,7 @@ public async Task CanInvokeFilter_OnVoidReturningHandler(Delegate @delegate)
// Act
var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5553,7 +5553,7 @@ async Task HandlerWithTaskAwait(HttpContext c)
// Act
var factoryResult = RequestDelegateFactory.Create(HandlerWithTaskAwait, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5620,7 +5620,7 @@ public async Task CanInvokeFilter_OnHandlerReturningTasksOfStruct(Delegate @dele
// Act
var factoryResult = RequestDelegateFactory.Create(@delegate, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
@@ -5656,11 +5656,11 @@ string HelloName(int? one, string? two, int? three, string? four, int? five, boo
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
- Assert.IsType(context);
+ Assert.IsType(context);
Assert.Equal(11, context.Arguments.Count);
return await next(context);
}
@@ -5687,11 +5687,11 @@ string HelloName()
// Act
var factoryResult = RequestDelegateFactory.Create(HelloName, new RequestDelegateFactoryOptions()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) => async (context) =>
{
- Assert.IsType(context);
+ Assert.IsType(context);
Assert.Equal(0, context.Arguments.Count);
return await next(context);
}
@@ -6081,7 +6081,7 @@ public void Create_ReturnsSameRequestDelegatePassedIn_IfNotModifiedByFilters()
RequestDelegateFactoryOptions options = new()
{
- RouteHandlerFilterFactories = new List>()
+ EndpointFilterFactories = new List>()
{
(routeHandlerContext, next) =>
{
diff --git a/src/Http/Routing/src/Builder/RouteHandlerFilterExtensions.cs b/src/Http/Routing/src/Builder/EndpointFilterExtensions.cs
similarity index 66%
rename from src/Http/Routing/src/Builder/RouteHandlerFilterExtensions.cs
rename to src/Http/Routing/src/Builder/EndpointFilterExtensions.cs
index 69c018cbb3ec..0fc669ec5223 100644
--- a/src/Http/Routing/src/Builder/RouteHandlerFilterExtensions.cs
+++ b/src/Http/Routing/src/Builder/EndpointFilterExtensions.cs
@@ -9,51 +9,50 @@
namespace Microsoft.AspNetCore.Http;
///
-/// Extension methods for adding to a route handler.
+/// Extension methods for adding to a route handler.
///
-public static class RouteHandlerFilterExtensions
+public static class EndpointFilterExtensions
{
///
/// Registers a filter onto the route handler.
///
/// The .
- /// The to register.
+ /// The to register.
/// A that can be used to further customize the route handler.
-
[RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
- public static TBuilder AddRouteHandlerFilter(this TBuilder builder, IRouteHandlerFilter filter) where TBuilder : IEndpointConventionBuilder =>
- builder.AddRouteHandlerFilter((routeHandlerContext, next) => (context) => filter.InvokeAsync(context, next));
+ public static TBuilder AddEndpointFilter(this TBuilder builder, IEndpointFilter filter) where TBuilder : IEndpointConventionBuilder =>
+ builder.AddEndpointFilter((routeHandlerContext, next) => (context) => filter.InvokeAsync(context, next));
///
/// Registers a filter of type onto the route handler.
///
/// The type of the to configure.
- /// The type of the to register.
+ /// The type of the to register.
/// The .
/// A that can be used to further customize the route handler.
[RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
- public static TBuilder AddRouteHandlerFilter(this TBuilder builder)
+ public static TBuilder AddEndpointFilter(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 TBuilder AddRouteHandlerFilter(this TBuilder builder, IR
///
/// Registers a filter of type onto the route handler.
///
- /// The type of the to register.
+ /// The type of the to register.
/// The .
/// A that can be used to further customize the route handler.
[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();
+ return builder.AddEndpointFilter();
}
///
/// Registers a filter of type onto the route handler.
///
- /// The type of the to register.
+ /// The type of the to register.
/// The .
/// A that can be used to further customize the route handler.
[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();
+ return builder.AddEndpointFilter();
}
///
@@ -95,10 +94,10 @@ public static TBuilder AddRouteHandlerFilter(this TBuilder builder, IR
/// A method representing the core logic of the filter.
/// A that can be used to further customize the route handler.
[RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
- public static TBuilder AddRouteHandlerFilter(this TBuilder builder, Func> routeHandlerFilter)
+ public static TBuilder AddEndpointFilter(this TBuilder builder, Func> routeHandlerFilter)
where TBuilder : IEndpointConventionBuilder
{
- return builder.AddRouteHandlerFilter((routeHandlerContext, next) => (context) => routeHandlerFilter(context, next));
+ return builder.AddEndpointFilter((routeHandlerContext, next) => (context) => routeHandlerFilter(context, next));
}
///
@@ -108,7 +107,7 @@ public static TBuilder AddRouteHandlerFilter(this TBuilder builder, Fu
/// A method representing the logic for constructing the filter.
/// A that can be used to further customize the route handler.
[RequiresUnreferencedCode(EndpointRouteBuilderExtensions.MapEndpointTrimmerWarning)]
- public static TBuilder AddRouteHandlerFilter(this TBuilder builder, Func filterFactory)
+ public static TBuilder AddEndpointFilter(this TBuilder builder, Func filterFactory)
where TBuilder : IEndpointConventionBuilder
{
builder.Add(endpointBuilder =>
@@ -118,8 +117,8 @@ public static TBuilder AddRouteHandlerFilter(this TBuilder builder, Fu
return;
}
- routeEndpointBuilder.RouteHandlerFilterFactories ??= new();
- routeEndpointBuilder.RouteHandlerFilterFactories.Add(filterFactory);
+ routeEndpointBuilder.EndpointFilterFactories ??= new();
+ routeEndpointBuilder.EndpointFilterFactories.Add(filterFactory);
});
return builder;
diff --git a/src/Http/Routing/src/CompositeEndpointDataSource.cs b/src/Http/Routing/src/CompositeEndpointDataSource.cs
index f9553720fd4d..bb4250d26bbf 100644
--- a/src/Http/Routing/src/CompositeEndpointDataSource.cs
+++ b/src/Http/Routing/src/CompositeEndpointDataSource.cs
@@ -76,7 +76,7 @@ public override IReadOnlyList Endpoints
}
///
- public override IReadOnlyList GetEndpointGroup(RouteGroupContext context)
+ public override IReadOnlyList GetGroupedEndpoints(RouteGroupContext context)
{
if (_dataSources.Count is 0)
{
@@ -90,7 +90,7 @@ public override IReadOnlyList GetEndpointGroup(RouteGroupContext conte
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.
diff --git a/src/Http/Routing/src/EndpointDataSource.cs b/src/Http/Routing/src/EndpointDataSource.cs
index 6cb05074eaa2..85c2da05d669 100644
--- a/src/Http/Routing/src/EndpointDataSource.cs
+++ b/src/Http/Routing/src/EndpointDataSource.cs
@@ -32,7 +32,7 @@ public abstract class EndpointDataSource
///
/// Returns a read-only collection of instances given the specified group and .
///
- public virtual IReadOnlyList GetEndpointGroup(RouteGroupContext context)
+ public virtual IReadOnlyList GetGroupedEndpoints(RouteGroupContext context)
{
// Only evaluate Endpoints once per call.
var endpoints = Endpoints;
diff --git a/src/Http/Routing/src/PublicAPI.Unshipped.txt b/src/Http/Routing/src/PublicAPI.Unshipped.txt
index 84250dfd97f8..bdffef2a88e3 100644
--- a/src/Http/Routing/src/PublicAPI.Unshipped.txt
+++ b/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!>! conventions, System.IServiceProvider! applicationServices) -> void
Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy(string! token, System.Type! type) -> void
Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy(string! token) -> void
-override Microsoft.AspNetCore.Routing.CompositeEndpointDataSource.GetEndpointGroup(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList!
+override Microsoft.AspNetCore.Routing.CompositeEndpointDataSource.GetGroupedEndpoints(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList!
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(this TBuilder builder) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter(this TBuilder builder, Microsoft.AspNetCore.Http.IEndpointFilter! filter) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter(this TBuilder builder, System.Func! filterFactory) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter(this TBuilder builder, System.Func>! routeHandlerFilter) -> TBuilder
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder! builder) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
+static Microsoft.AspNetCore.Http.EndpointFilterExtensions.AddEndpointFilter(this Microsoft.AspNetCore.Routing.RouteGroupBuilder! builder) -> Microsoft.AspNetCore.Routing.RouteGroupBuilder!
static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.ExcludeFromDescription(this TBuilder builder) -> TBuilder
static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithDescription(this TBuilder builder, string! description) -> TBuilder
static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithSummary(this TBuilder builder, string! summary) -> TBuilder
static Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.WithTags(this TBuilder builder, params string![]! tags) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(this TBuilder builder) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(this TBuilder builder, Microsoft.AspNetCore.Http.IRouteHandlerFilter! filter) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(this TBuilder builder, System.Func! filterFactory) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(this TBuilder builder, System.Func>! routeHandlerFilter) -> TBuilder
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder! builder) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
-static Microsoft.AspNetCore.Http.RouteHandlerFilterExtensions.AddRouteHandlerFilter(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! 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!
+virtual Microsoft.AspNetCore.Routing.EndpointDataSource.GetGroupedEndpoints(Microsoft.AspNetCore.Routing.RouteGroupContext! context) -> System.Collections.Generic.IReadOnlyList!
virtual Microsoft.AspNetCore.Routing.Patterns.RoutePatternTransformer.SubstituteRequiredValues(Microsoft.AspNetCore.Routing.Patterns.RoutePattern! original, Microsoft.AspNetCore.Routing.RouteValueDictionary! requiredValues) -> Microsoft.AspNetCore.Routing.Patterns.RoutePattern?
diff --git a/src/Http/Routing/src/RouteEndpointBuilder.cs b/src/Http/Routing/src/RouteEndpointBuilder.cs
index f037bea26bb2..b4c3e1e03468 100644
--- a/src/Http/Routing/src/RouteEndpointBuilder.cs
+++ b/src/Http/Routing/src/RouteEndpointBuilder.cs
@@ -13,9 +13,9 @@ namespace Microsoft.AspNetCore.Routing;
///
public sealed class RouteEndpointBuilder : EndpointBuilder
{
- // TODO: Make this public as a gettable IReadOnlyList>.
- // AddRouteHandlerFilter will still be the only way to mutate this list.
- internal List>? RouteHandlerFilterFactories { get; set; }
+ // TODO: Make this public as a gettable IReadOnlyList>.
+ // AddEndpointFilter will still be the only way to mutate this list.
+ internal List>? EndpointFilterFactories { get; set; }
///
/// Gets or sets the associated with this endpoint.
@@ -45,7 +45,7 @@ public RouteEndpointBuilder(
///
[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 override Endpoint Build()
// 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,
};
diff --git a/src/Http/Routing/src/RouteEndpointDataSource.cs b/src/Http/Routing/src/RouteEndpointDataSource.cs
index a9648210d1e8..e15e2da25943 100644
--- a/src/Http/Routing/src/RouteEndpointDataSource.cs
+++ b/src/Http/Routing/src/RouteEndpointDataSource.cs
@@ -58,7 +58,7 @@ public override IReadOnlyList Endpoints
}
}
- public override IReadOnlyList GetEndpointGroup(RouteGroupContext context)
+ public override IReadOnlyList GetGroupedEndpoints(RouteGroupContext context)
{
var endpoints = new RouteEndpoint[_routeEntries.Count];
for (int i = 0; i < _routeEntries.Count; i++)
@@ -179,14 +179,14 @@ private RouteEndpointBuilder CreateRouteEndpointBuilder(
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))
{
diff --git a/src/Http/Routing/src/RouteGroupBuilder.cs b/src/Http/Routing/src/RouteGroupBuilder.cs
index 1b135d3c786a..5075a53c3b94 100644
--- a/src/Http/Routing/src/RouteGroupBuilder.cs
+++ b/src/Http/Routing/src/RouteGroupBuilder.cs
@@ -48,7 +48,7 @@ public GroupEndpointDataSource(RouteGroupBuilder groupRouteBuilder)
public override IReadOnlyList Endpoints =>
GetGroupedEndpointsWithNullablePrefix(null, Array.Empty>(), _routeGroupBuilder._outerEndpointRouteBuilder.ServiceProvider);
- public override IReadOnlyList GetEndpointGroup(RouteGroupContext context) =>
+ public override IReadOnlyList GetGroupedEndpoints(RouteGroupContext context) =>
GetGroupedEndpointsWithNullablePrefix(context.Prefix, context.Conventions, context.ApplicationServices);
public IReadOnlyList GetGroupedEndpointsWithNullablePrefix(RoutePattern? prefix, IReadOnlyList> conventions, IServiceProvider applicationServices)
@@ -56,7 +56,7 @@ public IReadOnlyList GetGroupedEndpointsWithNullablePrefix(RoutePatter
return _routeGroupBuilder._dataSources.Count switch
{
0 => Array.Empty(),
- 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 @@ private IReadOnlyList SelectEndpointsFromAllDataSources(RouteGroupCont
foreach (var dataSource in _routeGroupBuilder._dataSources)
{
- groupedEndpoints.AddRange(dataSource.GetEndpointGroup(context));
+ groupedEndpoints.AddRange(dataSource.GetGroupedEndpoints(context));
}
return groupedEndpoints;
diff --git a/src/Http/Routing/src/RouteGroupContext.cs b/src/Http/Routing/src/RouteGroupContext.cs
index e27e3cf98e52..b9b5fd1de086 100644
--- a/src/Http/Routing/src/RouteGroupContext.cs
+++ b/src/Http/Routing/src/RouteGroupContext.cs
@@ -7,7 +7,7 @@
namespace Microsoft.AspNetCore.Routing;
///
-/// Represents the information accessible to .
+/// Represents the information accessible to .
///
public sealed class RouteGroupContext
{
@@ -30,7 +30,7 @@ public RouteGroupContext(RoutePattern prefix, IReadOnlyList
/// Gets the which should prefix the of all instances
- /// returned by the call to . This accounts for nested groups and gives the full group prefix
+ /// returned by the call to . This accounts for nested groups and gives the full group prefix
/// not just the prefix supplied to the innermost call to .
///
public RoutePattern Prefix { get; }
@@ -38,7 +38,7 @@ public RouteGroupContext(RoutePattern prefix, IReadOnlyList
/// Gets all conventions added to ancestor instances returned from
/// via . These should be applied in order when building every
- /// returned from .
+ /// returned from .
///
public IReadOnlyList> Conventions { get; }
diff --git a/src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs
index 42d69cd96c52..f7ab3518642b 100644
--- a/src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs
+++ b/src/Http/Routing/test/UnitTests/Builder/RequestDelegateEndpointRouteBuilderExtensionsTest.cs
@@ -109,7 +109,7 @@ public async Task MapEndpoint_ReturnGenericTypeTask_GeneratedDelegate(Func map)
+ public async Task MapEndpoint_CanBeFiltered_ByEndpointFilters(Func map)
{
var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(EmptyServiceProvider.Instance));
var httpContext = new DefaultHttpContext();
@@ -119,7 +119,7 @@ public async Task MapEndpoint_CanBeFiltered_ByRouteHandlerFilters(Func 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 void MapEndpoint_UsesOriginalRequestDelegateInstance_IfFilterDoesNotChang
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;
diff --git a/src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs
index ee5d2cc552b9..fcd2aa86f09c 100644
--- a/src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs
+++ b/src/Http/Routing/test/UnitTests/Builder/RouteHandlerEndpointRouteBuilderExtensionsTest.cs
@@ -851,8 +851,8 @@ public async Task MapMethod_DefaultsToNotThrowOnBadHttpRequestIfItCannotResolveR
public static object[][] AddFiltersByClassData =
{
- new object[] { (Action)((IEndpointConventionBuilder builder) => builder.AddRouteHandlerFilter(new IncrementArgFilter())) },
- new object[] { (Action)((IEndpointConventionBuilder builder) => builder.AddRouteHandlerFilter()) }
+ new object[] { (Action)((IEndpointConventionBuilder builder) => builder.AddEndpointFilter(new IncrementArgFilter())) },
+ new object[] { (Action)((IEndpointConventionBuilder builder) => builder.AddEndpointFilter()) }
};
public static object[][] AddFiltersByDelegateData
@@ -860,14 +860,14 @@ public static object[][] AddFiltersByDelegateData
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 @@ private static async Task AssertIdAsync(Endpoint endpoint, string expectedPatter
[Theory]
[MemberData(nameof(AddFiltersByClassData))]
[MemberData(nameof(AddFiltersByDelegateData))]
- public async Task AddRouteHandlerFilterMethods_CanRegisterFilterWithClassAndDelegateImplementations(Action addFilter)
+ public async Task AddEndpointFilterMethods_CanRegisterFilterWithClassAndDelegateImplementations(Action addFilter)
{
var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()));
@@ -924,7 +924,7 @@ public async Task AddRouteHandlerFilterMethods_CanRegisterFilterWithClassAndDele
[Theory]
[MemberData(nameof(AddFiltersByClassData))]
[MemberData(nameof(AddFiltersByDelegateData))]
- public async Task AddRouteHandlerFilterMethods_WorkWithMapGroup(Action addFilter)
+ public async Task AddEndpointFilterMethods_WorkWithMapGroup(Action addFilter)
{
var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().BuildServiceProvider()));
@@ -958,7 +958,7 @@ public async Task RequestDelegateFactory_CanInvokeEndpointFilter_ThatAccessesSer
string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}";
var routeHandlerBuilder = builder.Map("/", PrintLogger);
- routeHandlerBuilder.AddRouteHandlerFilter();
+ routeHandlerBuilder.AddEndpointFilter();
var dataSource = GetBuilderEndpointDataSource(builder);
// Trigger Endpoint build by calling getter.
@@ -991,7 +991,7 @@ public void RequestDelegateFactory_ProvidesAppServiceProvider_ToFilterFactory()
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();
@@ -1009,37 +1009,37 @@ public void RequestDelegateFactory_ProvidesAppServiceProvider_ToFilterFactory()
[Fact]
public void RouteHandlerContext_ThrowsArgumentNullException_ForMethodInfo()
{
- Assert.Throws("methodInfo", () => new RouteHandlerContext(null!, new List(), new ServiceCollection().BuildServiceProvider()));
+ Assert.Throws("methodInfo", () => new EndpointFilterFactoryContext(null!, new List(), new ServiceCollection().BuildServiceProvider()));
}
[Fact]
public void RouteHandlerContext_ThrowsArgumentNullException_ForEndpointMetadata()
{
var handler = () => { };
- Assert.Throws("endpointMetadata", () => new RouteHandlerContext(handler.Method, null!, new ServiceCollection().BuildServiceProvider()));
+ Assert.Throws("endpointMetadata", () => new EndpointFilterFactoryContext(handler.Method, null!, new ServiceCollection().BuildServiceProvider()));
}
[Fact]
public void RouteHandlerContext_ThrowsArgumentNullException_ForApplicationServices()
{
var handler = () => { };
- Assert.Throws("applicationServices", () => new RouteHandlerContext(handler.Method, new List(), null!));
+ Assert.Throws("applicationServices", () => new EndpointFilterFactoryContext(handler.Method, new List(), 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();
+ _logger = loggerFactory.CreateLogger();
_routeHandlerContext = routeHandlerContext;
}
- public async ValueTask InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next)
+ public async ValueTask 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 ServiceAccessingRouteHandlerFilter(ILoggerFactory loggerFactory, RouteHan
}
}
- class IncrementArgFilter : IRouteHandlerFilter
+ class IncrementArgFilter : IEndpointFilter
{
- public async ValueTask InvokeAsync(RouteHandlerInvocationContext context, RouteHandlerFilterDelegate next)
+ public async ValueTask InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)
{
context.Arguments[0] = ((int)context.Arguments[0]!) + 1;
return await next(context);
diff --git a/src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs b/src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs
index 9d5c6b73fa0f..c296a7d2e541 100644
--- a/src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs
+++ b/src/Http/Routing/test/UnitTests/CompositeEndpointDataSourceTest.cs
@@ -43,7 +43,7 @@ public void CreatesShallowCopyOf_ListOfGroupedEndpoints()
var conventions = Array.Empty>();
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 void GetGroupedEndpoints_ForwardedToChildDataSources()
};
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 @@ private class TestGroupDataSource : EndpointDataSource
public List> ResolvedGroupedEndpoints { get; } = new();
- public override IReadOnlyList GetEndpointGroup(RouteGroupContext context)
+ public override IReadOnlyList GetGroupedEndpoints(RouteGroupContext context)
{
ReceivedRouteGroupContexts.Add(context);
- var resolved = base.GetEndpointGroup(context);
+ var resolved = base.GetGroupedEndpoints(context);
ResolvedGroupedEndpoints.Add(resolved);
return resolved;
}
diff --git a/src/Http/samples/MinimalSample/Program.cs b/src/Http/samples/MinimalSample/Program.cs
index 41914ad574d0..0d6b123e380c 100644
--- a/src/Http/samples/MinimalSample/Program.cs
+++ b/src/Http/samples/MinimalSample/Program.cs
@@ -21,7 +21,7 @@
var outer = app.MapGroup("/outer");
var inner = outer.MapGroup("/inner");
-inner.AddRouteHandlerFilter((routeContext, next) =>
+inner.AddEndpointFilter((routeContext, next) =>
{
var tags = routeContext.EndpointMetadata.OfType().FirstOrDefault();
@@ -36,7 +36,7 @@
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 =>