I have a route url like http://localhost/p201/info
for which I want to choose the controller ProductController
. For http://localhost/p1201/info
also, I want the same ProductController
.
For a route like http://localhost/c301/info
, I want to select the CategoryController
.
I have a key-value dictionary in the app to choose the controller for a segment:
segment - controller
p201 - ProductController
p1201 - ProductController
c301 - CategoryController
What route extension I have to implement to dynamically select the controller from the key-value dictionary for a segment name and invoke the controller method?