I am expecting that a new controller for a Web Api (ie- no UI, no views etc), would be created by VS2017 to inherit from
AspNetCore.Mvc.ControllerBase (in Microsoft.AspNetCore.Mvc.Core.dll)
instead of from:
AspNetCore.Mvc.Controller (which is in the Microsoft.AspNetCore.Mvc.ViewFeatures.dll - and contains view support)
Example controller generated by VS:
namespace WebApi1.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// ....
Can someone help me understand if I'm missing something here?
If not, does anyone have any ideas on how to prevent use of Controller in a WebApi only project?
I had thought of a hacky method of implementing a base class in my WebApi1.Controllers namespace called Controller that effectively intercepts a WebApi controller that uses Controller over ControllerBase, but perhaps a filter might be better?