Cannot set DataTokens in MapHttpRoute extensions (HttpRouteCollectionExtensions, RouteCollectionExtensions)

Topics: ASP.NET Web API
Jul 17, 2013 at 8:03 AM
Is there any particular reason why MapHttpRoute extension methods do not let you set DataTokens dictionary?

Example from RouteCollectionExtensions (HttpRouteCollectionExtensions is similar):
public static Route MapHttpRoute(this RouteCollection routes, string name, string routeTemplate, object defaults, object constraints, HttpMessageHandler handler)
{
    if (routes == null)
    {
        throw Error.ArgumentNull("routes");
    }

    HttpRouteValueDictionary defaultsDictionary = new HttpRouteValueDictionary(defaults);
    HttpRouteValueDictionary constraintsDictionary = new HttpRouteValueDictionary(constraints);
    HostedHttpRoute httpRoute = (HostedHttpRoute)GlobalConfiguration.Configuration.Routes.CreateRoute(routeTemplate, defaultsDictionary, constraintsDictionary, dataTokens: null, handler: handler);
    Route route = httpRoute.OriginalRoute;
    routes.Add(name, route);
    return route;
}
So dataTokens parameter is set to null and that cannot be changed. It just unnecessary complicates matters.