As Bertrand already noted, what you need is a simple reflection over currently available Controller
types.
- Implement
IRouteProvider
as you already did. Grab all
Controller
types exported by currently enabled modulesIExtensionManager _extensions; ShellBlueprint _shell; ... var types = _extensions .LoadFeatures(_extensions.EnabledFeatures(_shell.Descriptor)) .SelectMany(feature => feature .ExportedTypes .Where(t => typeof(Controller).IsAssignableFrom(t)));
Loop over methods of each of the types above and pick those that have a given attribute defined. For each of the methods picked, fetch its name (action name), name of the assembly that contains its declaring type (area name) along with the attribute data (route pattern etc.).
- Having the collection above in hand, you can simply loop over it and return
new RouteDescriptor{ ... }
for each.