0

I was working on defining generic controller for my web application, similar to the one explained in this question. The difference is that, in my case, controller routing prefix can contain one (ie: /Person), two or (more general) n segments (ie. /hr/Employee, ...). The answer from Jeff Fritz suggested that custom IControllerFactory should be implemented. However, since my routing structure is pretty complex and, therefore, hard to implement using RouteAttribute or MapRoute function in Program.cs, provided custom IControllerFactory was not called and, thus, not working. I have seen that controller could be registered using custom IApplicationModelProvider implementation. I was wondering how should a generic controller be registered for it to contain all actions, properties, filters, route values and selectors as expected by the default IApplicationModelProvider implementation?

2
  • Have you checked this Docs? Commented Jun 13, 2023 at 7:57
  • @XinranShen I am currently lookung it up (to be more precise, I think I'll go with implementing my own IControllerModelConvention and providing custom IApplicationFeatureProvider) - I think it'll be both easier and cleaner than providing my own IApplicationModelProvider. Thanks for advice. Commented Jun 13, 2023 at 8:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.