First of all nice video! One point we are missing here is not all endpoints use same dependencies. If only some endpoints are using heavy objects then rest of the endpoints performance degrade if we are using controllers. We can avoid that using minimal api.
Never had a problem with minimal API setup or structure, ive got mine all nicely separated out by feature group and cannot see any reason to return to controllers. If you mess up your minimal APIs then the chances are you'll mess up your controllers 😂
What I love about minimal api's is that you no longer need to make a large file with all logic, you can put each endpoint in it's own file. great if you want to separate on feature level! Or if you want vertical slice architecture. The lads saying that minimal api's aren't for large projects simply haven't tried our minimal api's. It's perfectly able to do what a controller does, it's just a different flavour.
Great video, Came across this reddit thread and some of the misinformation in the replies got my piss boiling more than it should have tbh - I do primarily blame Microsoft though for coming up with yet another vague name for a product.
You can easily merge those attributes on a controller and on controller's actions to a single line on each to get a similar number of lines of code. Should you? No. The only "good reason" to switch to minimal API is performance if you are injecting a lot of unnecessary, transient and expensive to instantiate services to controllers because you structured them badly. The rest is just a matter of preference. There is nothing inherently better about the minimal API over the controllers approach.
Minimal APIs are less "magic", a similar way is used in most other languages, they aren't bloated by default. I think there are a fair share of advantages. Better question is, what controllers have over minimal APIs
I really don't think that 12 lines is worth it. How are you not bothered that the route definitions and documentations moved so far away from the actual implementations.
Moved so far away? They are in the same file. If you are that bothered by that you can always create an inline lambda function as your implementation, so your route, documentation and implementation are grouped together
Great video. Controllers just work. Minimal APIs require a whole setup and organizational flow. Minimal does not have that much less code? Keep in mind he deleted the comments in the minimal version but not in the controller version, which is weird. I’ll just use controllers, only refactored to minimal APIs if I ever need that extra performance. Most of us never do.
The comments in the controller version were required for the swagger documentation. Minimal APIs use methods like WithSummary() to add swagger docs rather than XML comments. Thats why they were removed
I am currently on a controllers vs minimal apis quest. Really want to like Minimal Apis, but registering endpoints and groups seems lacking. I mean the methods are there, it's not rocket science, but I don't like the hoops you have to go jumo through to make it work elegantly. I wish MS would just port all the attributes over for Minimal APIs, then it would be great.
@@victor1882 if you are injecting that many services into your controller you have a problem and also if you have a giant constrcutor you will equally have a giant method
@@victor1882 you dont have controllers with giant constructors, you have a controller that should have 1 businesslayer and that businesslayer shall act as a higher orchestration layer
@@victor1882 i dont know enough about minimal API to spare with you on that subject, I've only gave a solution to your statement about huge ctors in controllers , I assume that if you have huge ctors controllers your controllers are fat and not thin, then your controllers are probably doing more than it should according to SOC principle
First of all nice video! One point we are missing here is not all endpoints use same dependencies. If only some endpoints are using heavy objects then rest of the endpoints performance degrade if we are using controllers. We can avoid that using minimal api.
[FromServices]
Glad I stumbled on this through reddit. Great vid, and it looks like a great channel! Ty for sharing.
Thank you! Glad you enjoyed it
Man I missed your videos, quality is top notch and the advice is even better, keep going!
Thanks Victor
Great video mate. Subscribed!
Glad you liked it. Thanks for the sub!
Never had a problem with minimal API setup or structure, ive got mine all nicely separated out by feature group and cannot see any reason to return to controllers. If you mess up your minimal APIs then the chances are you'll mess up your controllers 😂
Fantastic video. Well explained and described and straight to the point. Thanks!
Going to check out the rest of your vids.
Thank you! I appreciate the positive feedback. Glad you liked it!
What I love about minimal api's is that you no longer need to make a large file with all logic, you can put each endpoint in it's own file. great if you want to separate on feature level! Or if you want vertical slice architecture.
The lads saying that minimal api's aren't for large projects simply haven't tried our minimal api's. It's perfectly able to do what a controller does, it's just a different flavour.
Confidently incorrect redditor. Nice explanation. +sub
Thanks for the sub!
Just found your channel, great stuff!!
I am trusting what is saying not to trust internet. Thanks for great video
Amazing content, thanks! 🔥
Thank you!
This is a great refactoring... I was using something different but this is more direct...
Glad you found it useful
Great video, Came across this reddit thread and some of the misinformation in the replies got my piss boiling more than it should have tbh - I do primarily blame Microsoft though for coming up with yet another vague name for a product.
Minimal Api is annoying with repetition of injections but Controllers are a little less performant.
Maybe a group injection will help minimal api.
New Subscriber here. Nice stuff
Thank you!
Thank you dude 👍🏼
No problem 👍
You forgot to remove the summaries in the traditional controller! thats why the minimal api has less lines of code! 🙂
You can easily merge those attributes on a controller and on controller's actions to a single line on each to get a similar number of lines of code. Should you? No. The only "good reason" to switch to minimal API is performance if you are injecting a lot of unnecessary, transient and expensive to instantiate services to controllers because you structured them badly. The rest is just a matter of preference. There is nothing inherently better about the minimal API over the controllers approach.
Minimal APIs are less "magic", a similar way is used in most other languages, they aren't bloated by default. I think there are a fair share of advantages. Better question is, what controllers have over minimal APIs
"Don't trust everything on the internet". That was the best part of the video 😜
Thanks bro
I really don't think that 12 lines is worth it. How are you not bothered that the route definitions and documentations moved so far away from the actual implementations.
Moved so far away? They are in the same file. If you are that bothered by that you can always create an inline lambda function as your implementation, so your route, documentation and implementation are grouped together
Great video. Controllers just work. Minimal APIs require a whole setup and organizational flow. Minimal does not have that much less code? Keep in mind he deleted the comments in the minimal version but not in the controller version, which is weird. I’ll just use controllers, only refactored to minimal APIs if I ever need that extra performance. Most of us never do.
The comments in the controller version were required for the swagger documentation. Minimal APIs use methods like WithSummary() to add swagger docs rather than XML comments. Thats why they were removed
I am currently on a controllers vs minimal apis quest. Really want to like Minimal Apis, but registering endpoints and groups seems lacking. I mean the methods are there, it's not rocket science, but I don't like the hoops you have to go jumo through to make it work elegantly. I wish MS would just port all the attributes over for Minimal APIs, then it would be great.
If it’s not minimal api then i don’t even want to use dotnet 😂. It’s the only thing i use in dotnet period.
Minimal api’s are a gimmick. Just. Say. No.
Tbh this sound like using controllers with extra steps and the need to DI into each method is annoying
not as annoying as having controllers with giant constructors
@@victor1882 if you are injecting that many services into your controller you have a problem and also if you have a giant constrcutor you will equally have a giant method
@@victor1882 you dont have controllers with giant constructors, you have a controller that should have 1 businesslayer and that businesslayer shall act as a higher orchestration layer
@@o0Qu but then we could go all the way and have an endpoint that represents one use case with minimal APIs
@@victor1882 i dont know enough about minimal API to spare with you on that subject, I've only gave a solution to your statement about huge ctors in controllers , I assume that if you have huge ctors controllers your controllers are fat and not thin, then your controllers are probably doing more than it should according to SOC principle