3 ms·
"if you load the routes from a database" Serious question (honestly not being snarky) - why would you want to do that?
by arethuza 5y ago
"if you load the routes from a database"
Serious question (honestly not being snarky) - why would you want to do that?
- andix 5y agoI don’t know, nobody needs more the 640k of RAM, right? Maybe you have multiple modules, and depending on the configuration the routing changes. Or feature flags, that enable a breaking api change. Or a stupid customer that pays you a million dollar for custom routes. But what benefit do the attributes bring? You need to learn them by heart, on builders Intellisense can help you.
- arethuza 5y agoWell 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...
- andix 5y agoAnother 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.
- aliswe 5y agoCMS:s do that! Any kind of editorial content being served is a use case.