Route - DataTokens property now null ?

Topics: ASP.NET Web API
Aug 29, 2012 at 8:21 PM
Edited Aug 29, 2012 at 8:32 PM

Between the RC and the RTM there appears to have been a change to Routes.  In the RC the DataTokens property is initialized with an empty RouteDictionary.  In the RTM the property is not initialized. 

Tiny Example:

Route  r;
r = routes.MapHttpRoute( 
                   name          : "Dashboard",
                   routeTemplate : "/Dashboard/{controller}/{id}",
                   defaults      : new { id = RouteParameter.Optional } );

//used to work, but now explodes ..needs to be manually initalized
r.DataTokens["Namespaces"] = "MyProject.UI.Controllers.Dashboard";

Is this on purpose or should I submit an issue?


Jun 23, 2014 at 9:34 PM
@doogie04 - did you ever find out if this is a bug or a "feature"?
Jul 7, 2014 at 6:44 PM
Edited Jul 7, 2014 at 6:47 PM
I never heard anything back, but it's been the situation for almost 2 years and three releases. So I guess it's a feature.

Turns out it's not that big a deal -- just use a little helper function. Nothing fancy, but you can see the little helper I use here :