This project is read-only.

Adding Controllers from Different Assembly

Aug 28, 2012 at 7:49 PM

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.

Aug 28, 2012 at 8:14 PM

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.

Marked as answer by maxtoroq on 10/15/2013 at 9:23 AM
Aug 29, 2012 at 4:18 PM

Thanks!   Removing a plugin might be a nice feature!