using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; namespace Umbraco.Cms.Web.Common.Extensions; /// /// Extension methods for LinkParser. /// public static class LinkParserExtensions { /// /// Parses the path using the specified endpoint and returns the route values if a the path matches the route pattern. /// /// The link parser. /// The endpoint. /// The path to parse. /// The route values if the path matches or null. public static RouteValueDictionary? ParsePathByEndpoint(this LinkParser linkParser, Endpoint endpoint, PathString path) { var name = endpoint.GetRouteName(); if (name != null) { return linkParser.ParsePathByEndpointName(name, path); } else { return null; } } }