Regardless of whether you go for POCO or non-POCO controllers, ASP.NET Core will apply the same rules for discovering controllers, which are as follows:
- They need to have the Controller suffix (strictly speaking, this can be changed, but we will leave this for now).
- They need to be instantiable classes (nonabstract, nongeneric, and nonstatic).
- They cannot have the [NonController] attribute applied to them.
- If they are POCO and do not have the Controller suffix, you can decorate them with the [Controller] attribute.
By convention, the files that contain the controller classes are stored in a folder called Controllers, and also in a Controllers namespace, but this is just ignored.
Controller classes are looked up by the name in the route—the controller parameter—and they are searched in the assemblies registered for that purpose. By default, the currently executing assembly...