This project is read-only.

Custom names for types/namespaces

Oct 27, 2011 at 11:42 AM


first of all thanks for the great job you have done with this library!

I would need to use custom names for some of the types and namespaces of my web application and I am wondering if McvCodeRouting supports this scenario. Basically, I would need to map a controller with a name like this:


To an url like this:


I hoped that the RouteFormatter settings would allow me to do that but it seems that its support is limited to a simple casing-change scenario only.
Unfortunately, the following code throws an exception (Only case formatting is currently supported for Namespace route segments).



               rootNamespace: typeof(Controllers.HomeController).Namespace,
               settings: new CodeRoutingSettings
                   RouteFormatter = (segment, segmentType) =>
                        switch (segmentType)
                            case RouteSegmentType.Namespace:
                                    if (segment == "MyCoolNamespace")
                                        return "my-cool-namespace";


                        return segment;

Am I missing something?

Thank you so much for your help.


Oct 27, 2011 at 5:00 PM

What you are trying to do is currently not supported, but it's something I intend to work on in the future. Stay tuned.

Dec 11, 2011 at 10:33 PM

This is now supported (in the latest revision) for namespace segments. Next I'll be working on the support for controller segments.

Dec 16, 2011 at 5:53 AM

Ditto for controller segments, coming in the next release.

Dec 16, 2011 at 8:53 AM

Thanks a lot!

In the meanwhile, however, I've started a new MVC routing extension project on my own, built from scratch; so, unfortunately, I don't have the time to check the bounty of your new additions although I am sure they rock like everything else on this project.

Thanks again.