Open
Description
Based on this topic:
#18883
The "IRouter.RouteAsync" alternative is "DynamicRouteValueTransformer.TransformAsync".
What is the "VirtualPathData GetVirtualPath(VirtualPathContext context)" alternative for complex url generation?
For example:
public override VirtualPathData GetVirtualPath(VirtualPathContext context)
{
var routeContext = context["context"] as new ProductListRouteContext();
var pathSegements = new List<string>();
if (context?.Category?.PageName != null)
{
pathSegments.Add(context.Category.PageName);
}
// Add other pathSegements based on the context/filters...
return new new VirtualPathData(this, string.Join("/", pathSegments));
}
In my view:
Url.RouteUrl("ProductList", new { context = Model.ProductListRouteContext });
Metadata
Metadata
Assignees
Labels
Work that is critical for the release, but we could probably ship withoutThis issue impacts very few customersIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesThis issue represents an ask for new feature or an enhancement to an existing oneThis label is used by an internal tool