I got a common library for .NET Core 3.1, in which I created a WEB API controller intended for sharing with multiple applications.
In order to add this to an application, I expected to something like this (from 3.0):
services.AddControllers()
.PartManager.ApplicationParts.Add(new AssemblyPart(assembly));
However, if I simply reference the common project, and call services.AddControllers(), the controller get added automagickally.. which is kinda spooky. Apparently, AddControllers() traverses every assembly in all referenced projects, and just stupidly adds every controller it finds along the way.
I can't find documentation on this behaviour. The only way I can see to control this, is to create another project with the controller, and reference it when needed.
What's the correct (or intended) way of doing this ?