diff --git a/src/Http/Http/src/Internal/ApplicationBuilder.cs b/src/Http/Http/src/Internal/ApplicationBuilder.cs index 33c8880315..483dbee1e6 100644 --- a/src/Http/Http/src/Internal/ApplicationBuilder.cs +++ b/src/Http/Http/src/Internal/ApplicationBuilder.cs @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Builder.Internal var message = $"The request reached the end of the pipeline without executing the endpoint: '{endpoint.DisplayName}'. " + $"Please register the EndpointMiddleware using '{nameof(IApplicationBuilder)}.UseEndpoints(...)' if using " + - $"routing, or '{nameof(IApplicationBuilder)}.UseEndpointExecutor()' if not using routing."; + $"routing."; throw new InvalidOperationException(message); } diff --git a/src/Http/Http/test/Internal/ApplicationBuilderTests.cs b/src/Http/Http/test/Internal/ApplicationBuilderTests.cs index ec03ea94f0..7e3c7f80c0 100644 --- a/src/Http/Http/test/Internal/ApplicationBuilderTests.cs +++ b/src/Http/Http/test/Internal/ApplicationBuilderTests.cs @@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Builder.Internal var expected = "The request reached the end of the pipeline without executing the endpoint: 'Test endpoint'. " + "Please register the EndpointMiddleware using 'IApplicationBuilder.UseEndpoints(...)' if " + - "using routing, or 'IApplicationBuilder.UseEndpointExecutor()' if not using routing."; + "using routing."; Assert.Equal(expected, ex.Message); Assert.False(endpointCalled); } diff --git a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs index 9ca47cf13e..cd5eabe1a7 100644 --- a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs +++ b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs @@ -15,7 +15,6 @@ namespace Microsoft.AspNetCore.Builder } public static partial class EndpointRoutingApplicationBuilderExtensions { - public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseEndpointExecutor(this Microsoft.AspNetCore.Builder.IApplicationBuilder builder) { throw null; } public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseEndpoints(this Microsoft.AspNetCore.Builder.IApplicationBuilder builder, System.Action configure) { throw null; } public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseRouting(this Microsoft.AspNetCore.Builder.IApplicationBuilder builder) { throw null; } } diff --git a/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs b/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs index a253c700de..b60a87c432 100644 --- a/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs +++ b/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs @@ -103,31 +103,6 @@ namespace Microsoft.AspNetCore.Builder return builder.UseMiddleware(); } - /// - /// Adds a middleware to the specified that will - /// execute the associated with the current request. - /// - /// The to add the middleware to. - /// A reference to this instance after the operation has completed. - /// - /// - /// A call to may be used to execute an endpoint with - /// using . This enables applications to use endpoints with other - /// middleware not related to routing. - /// - /// - public static IApplicationBuilder UseEndpointExecutor(this IApplicationBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - // Note: we don't require routing services either. - - return builder.UseMiddleware(); - } - private static void VerifyRoutingServicesAreRegistered(IApplicationBuilder app) { // Verify if AddRouting was done before calling UseEndpointRouting/UseEndpoint diff --git a/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs index 0da1e56bdb..9a6f3df066 100644 --- a/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs +++ b/src/Http/Routing/test/UnitTests/Builder/EndpointRoutingApplicationBuilderExtensionsTest.cs @@ -295,37 +295,6 @@ namespace Microsoft.AspNetCore.Builder e => Assert.Equal("Test endpoint 4", e.DisplayName)); } - [Fact] - public async Task UseEndpointExecutor_RunsEndpoint() - { - // Arrange - var services = CreateServices(); - - var endpointRan = false; - var app = new ApplicationBuilder(services); - - app.Use(next => context => - { - context.SetEndpoint(new Endpoint(c => - { - endpointRan = true; - return Task.CompletedTask; - }, new EndpointMetadataCollection(), "Test")); - return next(context); - }); - - app.UseEndpointExecutor(); // No services required, no UseRouting required - - var appFunc = app.Build(); - var httpContext = new DefaultHttpContext(); - - // Act - await appFunc(httpContext); - - // Assert - Assert.True(endpointRan); - } - private IServiceProvider CreateServices() { return CreateServices(matcherFactory: null);