-
Notifications
You must be signed in to change notification settings - Fork 2.1k
How do I use ControllerFeature instead of IControllerTypeProvider? #5004
Comments
You can populate a What is it you're trying to do exactly? Looking at the types of controllers is going to miss some of the metadata that affects how actions are mapped. |
@rynowak Ok, so I did this instead. services.AddSingleton<ApplicationPartManager>(); Then in my public ControllerMapper(ApplicationPartManager manager) {
var feature = new ControllerFeature();
manager.PopulateFeature(feature);
... But To make a long story short, I'm developing a CMS (still prototype) and I use dynamic and, according to me more readable hierarchical urls not based on the the controller name e.g. For this I use a custom router which is the first route in the list, this is how the lookup works. If the lookup find a a node with a controller, I would like to check if that action on that controller exists. I would appreciate feedback on how I could improve routing code. |
You shouldn't have to register the If you want to use |
@rynowak Ok, changed it to this and it seems to work, at least with one assembly. services.AddMvc().ConfigureApplicationPartManager(manager =>
{
var feature = new ControllerFeature();
manager.PopulateFeature(feature);
services.AddSingleton<IControllerMapper>(new ControllerMapper(feature));
}); |
In RC1 I used the
IControllerTypeProvider
in my custom router to check if one controller has a specific action. In RC2 it seems to be removed and maybe replaced with ControllerFeature? I tried to replaceIControllerTypeProvider
withControllerFeature
but that guy is null.This is how I used the
IControllerTypeProvider
and now I want to replace it with theControllerFeature
, I think?The text was updated successfully, but these errors were encountered: