Re:Minimal APIs at a glance in .NET 6
by arethuza on Monday September 13, 2021 @10:00AM
(#28511593)
Well yes - if you need some kind of dynamically configurable routing then attributes aren't a good fit. I like the fact they are there right next to the relevant method...
[ Parent
| on HN ]
Another thing is, that attributes totally opinionate your code. You pull in a framework into your code.
If you - for example - write one controller you want to use with multiple frameworks (ASP.NET Core or Nancy), you need one controller per framework, just for the attributes.
I always found them more annoying then helpful. Most people seem to see it that way. Most frameworks are moving away from attributes for a good reason.