From 44f5b54f5fdabf0696708654ef64a3a318767594 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Thu, 2 Aug 2018 13:37:43 +1200 Subject: [PATCH] React to routing API review (#8194) --- build/dependencies.props | 4 ++-- .../Internal/MvcEndpointDataSource.cs | 2 +- .../Routing/ActionConstraintMatcherPolicy.cs | 2 +- .../Routing/EndpointRoutingUrlHelper.cs | 9 ++++----- .../Routing/UrlHelperFactory.cs | 3 +-- .../Internal/MvcEndpointDataSourceTests.cs | 2 +- .../Routing/ActionConstraintMatcherPolicyTest.cs | 2 +- .../Routing/EndpointRoutingUrlHelperTest.cs | 2 +- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index d443b2338e..9ab9fc484e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -48,8 +48,8 @@ 2.2.0-preview1-34823 2.2.0-preview1-34823 2.2.0-preview1-34823 - 2.2.0-preview1-34823 - 2.2.0-preview1-34823 + 2.2.0-a-preview1-routing-api-review-p1-16821 + 2.2.0-a-preview1-routing-api-review-p1-16821 2.2.0-preview1-34823 2.2.0-preview1-34823 2.2.0-preview1-34823 diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs index b16b9ed018..867d5dd5ed 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcEndpointDataSource.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ActionConstraints; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Metadata; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Template; diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs b/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs index 60a1abe6b1..090ade0cf1 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Routing/ActionConstraintMatcherPolicy.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ActionConstraints; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Mvc.Routing diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Routing/EndpointRoutingUrlHelper.cs b/src/Microsoft.AspNetCore.Mvc.Core/Routing/EndpointRoutingUrlHelper.cs index 27590902e9..6f24248950 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Routing/EndpointRoutingUrlHelper.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Routing/EndpointRoutingUrlHelper.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Mvc.Routing @@ -16,7 +15,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing { private readonly ILogger _logger; private readonly LinkGenerator _linkGenerator; - private readonly IEndpointFinder _routeValuesBasedEndpointFinder; + private readonly IEndpointFinder _routeValuesBasedEndpointFinder; /// /// Initializes a new instance of the class using the specified @@ -30,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing /// The . public EndpointRoutingUrlHelper( ActionContext actionContext, - IEndpointFinder routeValuesBasedEndpointFinder, + IEndpointFinder routeValuesBasedEndpointFinder, LinkGenerator linkGenerator, ILogger logger) : base(actionContext) @@ -87,7 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing } var endpoints = _routeValuesBasedEndpointFinder.FindEndpoints( - new RouteValuesBasedEndpointFinderContext() + new RouteValuesAddress() { ExplicitValues = valuesDictionary, AmbientValues = AmbientValues @@ -124,7 +123,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing var valuesDictionary = routeContext.Values as RouteValueDictionary ?? GetValuesDictionary(routeContext.Values); var endpoints = _routeValuesBasedEndpointFinder.FindEndpoints( - new RouteValuesBasedEndpointFinderContext() + new RouteValuesAddress() { RouteName = routeContext.RouteName, ExplicitValues = valuesDictionary, diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperFactory.cs index b6c5acfdf4..fb6bbb0ae5 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Routing/UrlHelperFactory.cs @@ -5,7 +5,6 @@ using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Core; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -52,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing { var services = httpContext.RequestServices; var linkGenerator = services.GetRequiredService(); - var routeValuesBasedEndpointFinder = services.GetRequiredService>(); + var routeValuesBasedEndpointFinder = services.GetRequiredService>(); var logger = services.GetRequiredService>(); urlHelper = new EndpointRoutingUrlHelper( diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs index c49d9f0243..6304099fc0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/MvcEndpointDataSourceTests.cs @@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Moq; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ActionConstraintMatcherPolicyTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ActionConstraintMatcherPolicyTest.cs index 51a00d6ddd..77288f75d3 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ActionConstraintMatcherPolicyTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ActionConstraintMatcherPolicyTest.cs @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs index faa0eebf0c..867832e808 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/EndpointRoutingUrlHelperTest.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions;