React to LinkGenerator api changes

This commit is contained in:
Kiran Challa 2018-07-17 05:08:06 -07:00
parent 42218d5fb5
commit 0caacb8217
2 changed files with 7 additions and 5 deletions

View File

@ -9,13 +9,13 @@ using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Routing
{
/// <summary>
/// An implementation of <see cref="IUrlHelper"/> that uses <see cref="ILinkGenerator"/> to build URLs
/// An implementation of <see cref="IUrlHelper"/> that uses <see cref="LinkGenerator"/> to build URLs
/// for ASP.NET MVC within an application.
/// </summary>
internal class DispatcherUrlHelper : UrlHelperBase
{
private readonly ILogger<DispatcherUrlHelper> _logger;
private readonly ILinkGenerator _linkGenerator;
private readonly LinkGenerator _linkGenerator;
private readonly IEndpointFinder<RouteValuesBasedEndpointFinderContext> _routeValuesBasedEndpointFinder;
/// <summary>
@ -26,12 +26,12 @@ namespace Microsoft.AspNetCore.Mvc.Routing
/// <param name="routeValuesBasedEndpointFinder">
/// The <see cref="IEndpointFinder{T}"/> which finds endpoints by required route values.
/// </param>
/// <param name="linkGenerator">The <see cref="ILinkGenerator"/> used to generate the link.</param>
/// <param name="linkGenerator">The <see cref="LinkGenerator"/> used to generate the link.</param>
/// <param name="logger">The <see cref="ILogger"/>.</param>
public DispatcherUrlHelper(
ActionContext actionContext,
IEndpointFinder<RouteValuesBasedEndpointFinderContext> routeValuesBasedEndpointFinder,
ILinkGenerator linkGenerator,
LinkGenerator linkGenerator,
ILogger<DispatcherUrlHelper> logger)
: base(actionContext)
{
@ -94,6 +94,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
});
var successfullyGeneratedLink = _linkGenerator.TryGetLink(
ActionContext.HttpContext,
endpoints,
valuesDictionary,
AmbientValues,
@ -128,6 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
});
var successfullyGeneratedLink = _linkGenerator.TryGetLink(
ActionContext.HttpContext,
endpoints,
valuesDictionary,
AmbientValues,

View File

@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
if (endpointFeature?.Endpoint != null)
{
var services = httpContext.RequestServices;
var linkGenerator = services.GetRequiredService<ILinkGenerator>();
var linkGenerator = services.GetRequiredService<LinkGenerator>();
var routeValuesBasedEndpointFinder = services.GetRequiredService<IEndpointFinder<RouteValuesBasedEndpointFinderContext>>();
var logger = services.GetRequiredService<ILogger<DispatcherUrlHelper>>();