While reading this question today and making same mistake in past myself, I wondered if it's required (due to default convention?) that we MUST suffix "Controller" to a class name that is derived from Controller
class in ASP.NET MVC, why compliler does not complain at all? At least a warning would save someone's time.
So below code will not work:
public class Search : Controller
{
// GET: /Search/
public ActionResult List()
{
var model = new MyModel();
return View(model);
}
}
So my question are:
- Can we change this convention i.e. can I change setting somewhere and make suffix text 'MvcController' instead?
- More important one, What is the reason C# compiler doesn't complain? It can not figure it out or it is not desired/illogical?
The question and answer does not answer both of my question so I think it is not exact duplicate.