1

In MVC-3 my application some controllers do similar things (CRUD and Index). Therefore I have created an abstract base controller in which the similar tasks are implemented. The other controller simply extend the base controller.

Now, everything is working just fine. But I am confused with the naming of the base controller. All controller class names must end with 'Controller' to make MVC work properly. However, my base controller will never be used directly. Therefore, it NEED NOT end with 'Controller'. Also, as it does not do the actual task of a controller, I think it should not sound like a controller.

So, what should be the name of my base controller? Which one is better: MyBaseController or MyControllerBase or JustLikeOtherAbstractClasses ?

Mohayemin
  • 3,841
  • 4
  • 25
  • 54
  • I have read this http://stackoverflow.com/questions/181597/what-are-the-naming-guidelines-for-asp-net-controls. Did not help much. – Mohayemin Apr 12 '12 at 11:59
  • We use `MyControllerBase` in our projects. I think there is no general guideline for naming Controller base classes. Use whatever name you like, just stay consistent. – nemesv Apr 12 '12 at 12:25
  • @nemesv: `MyControllerBase` is what I also think is better. And I will stay consistent. Why don't you make your comment an answer? – Mohayemin Apr 12 '12 at 12:30

1 Answers1

0

In our projects we are using the MyControllerBase naming convention. Because there is no guideline/convention how a Controller base class should be named you can use whatever name you like, just stay consistent.

Basically you are tring to name an abstract base class here, which has some options:

Community
  • 1
  • 1
nemesv
  • 138,284
  • 16
  • 416
  • 359