Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.
Commented on
Is there a way to add Controller from all assemblies without calling Routes.MapCodeRoutes for each?
If I have a plugin type framework, I do not want the base to know about the plugins and I prefer not to have to have the plugins register their routes if I am using the standard {controller}/{action}/{id} format.
No, you have to make an explicit MapCodeRoutes call. This is by design. However, there's room for improvement and I'm open to that. Plugins should not register themselves, you need to write some code that finds all plugin assemblies, finds the root controller for each plugin and call MapCodeRoutes for each. It would be nice to be able to pass the assembly and have MvcCodeRouting find the outermost controller and treat that as root. Note that you can dynamically add plugins by calling MapCodeRoutes at runtime, and I've been thinking about adding a method for removing plugins also.