1

How can we make controller classes without suffixing "Controller" in the class name?

4
  • 4
    This is part of MVC's Convention Over Configuration philosophy. You may be able to change this convention, but why would you want to? Commented May 10, 2011 at 10:13
  • 3
    Why would you want to defy the convention? It makes things much easier on other developers who have to maintain the code. Commented May 10, 2011 at 10:14
  • .net mvc is opensource technology, you can dowload sourses and rewrite all mvc source code to the way that you want Commented May 10, 2011 at 10:22
  • Are there any examples available for this? Commented May 10, 2011 at 10:34

1 Answer 1

4

It is convention by default and is implemented in DefaultControllerFactory Class. You could create your own controller factory class that implements IControllerFactory and then use the code in Global.asax to make application use your controller factory

        protected void Application_Start()
        {
...
            ControllerBuilder.Current.SetControllerFactory(MyControllerFactory);
...
        }
Sign up to request clarification or add additional context in comments.

Comments

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.