Last week I talked about the [ApiExplorer]
attribute and how it can simplify your controller code when implementing Web API's.
Today I have a small tip for you, did you know it isn't necessary to annotate every controller with the [ApiExplorer]
attribute?
It is also possible to apply the attribute to an assembly. When the [ApiController]
attribute is applied to an assembly, all controllers in the assembly have the [ApiController]
attribute applied.
Therefore apply the assembly-level attribute to the Program.cs
file: