My .NET Core 3.1 application contains multiple REST endpoints that I splitted in 3 ApiController. I would like to activate the controller from the appsettings.
Each controller is using some DependencyInjection to use the related components that do the job.
All configuration and controller part are running ok, I already filtered out the 'related components' but I struggle to filter out some controller to be created?
Looking at the filter as described here: https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1 is probably the wrong tool since I want to prevent completly the controller class to be created!
I am looking at
services.AddControllers(options =>
{
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers(); // I only see the default endpoint here
});
and also on the Swagger generation options but don't yet find the appropriate solution for .NET Core 3.x
Any ideas?