1

On my MVC app, I am planning to create a generic method for Web Api's. This can be achieved either creating methods on Base Controller or methods in Utility helper class. Which is preferred way Base controller (or) Utility Class?

And also want to know on what scenario's Base Controller is useful.

user472269
  • 367
  • 1
  • 4
  • 19
  • what kind of generic methods? Utility itself has meaningless name :) – cuongle Jun 01 '16 at 15:50
  • Possible duplicate of [What are good candidates for base controller class in ASP.NET MVC?](http://stackoverflow.com/questions/6119206/what-are-good-candidates-for-base-controller-class-in-asp-net-mvc) – James P Jun 02 '16 at 01:20

1 Answers1

0

ASP.NET MVC provides several alternatives to common problems (e.g. logging, exception handling, authorization) using filters or allowing your own implementation of a certain class. Usually a base controller is not the best approach since it is very likely the framework already handles the issue by other means.

Take a look at this answer for how to deal with common problems in ASP.NET MVC: https://stackoverflow.com/a/6119341/1942895

Community
  • 1
  • 1
Rafael Companhoni
  • 1,780
  • 1
  • 15
  • 31