I've got an ASP.NET Core API that references a nuget package that contains a Controller
.
By default, this controller is registered and can respond to requests. However, I only want to add this in certain circumstances - e.g. if it's in the DEV environment.
My Startup
looks like this:
services.AddControllers()
.AddMvcOptions(cfg => {
cfg.Filters.Add(new CustomExceptionFilterAttribute())
});
I expected I'd need to call AddApplicationPart(typeof(ClassInPackage).Assembly)
after calling AddCointrollers
to register this controller?
Can someone advise a way I can enable / disable the registration of this controller?