[Fixes #3749] Expose ActionContext on IUrlHelper

This commit is contained in:
Ajay Bhargav Baaskaran 2015-12-30 16:23:49 -08:00
parent dc968bc1bf
commit 1f87442092
3 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,11 @@ namespace Microsoft.AspNet.Mvc
/// </summary>
public interface IUrlHelper
{
/// <summary>
/// Gets the <see cref="ActionContext"/> for the current request.
/// </summary>
ActionContext ActionContext { get; }
/// <summary>
/// Generates a fully qualified or absolute URL specified by <see cref="UrlActionContext"/> for an action
/// method, which contains action name, controller name, route values, protocol to use, host name, and fragment.

View File

@ -32,9 +32,10 @@ namespace Microsoft.AspNet.Mvc.Routing
ActionContext = actionContext;
}
protected RouteValueDictionary AmbientValues => ActionContext.RouteData.Values;
/// <inheritdoc />
public ActionContext ActionContext { get; }
protected ActionContext ActionContext { get; }
protected RouteValueDictionary AmbientValues => ActionContext.RouteData.Values;
protected HttpContext HttpContext => ActionContext.HttpContext;

View File

@ -595,6 +595,8 @@ namespace Microsoft.AspNet.Mvc
_url = url;
}
public ActionContext ActionContext { get; }
public object RouteValues { get; private set; }
public string Action(UrlActionContext actionContext)