Hello! I’m a Husband, Father, Movember & Liverpool Fan, Software Engineer, Constant Learner & Team Leader. I live in Wisconsin, work for Catalyst and spend my days trying to balance all of the above.
Hey that's pretty cool, but honestly I don't mind the new setup. I just don't want everything in the one file. It's maybe cool for small projects or little things but when you're configuring logging, telemetry, swagger etc that Program.cs blows out quickly.
I can easily create extension methods on the WebApplicationBuilder and WebApplication in say a ProgramExtensions.cs file and I find it helps with that separation, just like Startup.cs did.
Also not a huge fan of the minimal api setup, but if when implementing those, I'd use extension methods to separate out pseudo controllers too
I have to admit that you are right, the Program.cs does look like a good idea but the fact that it is blowing up when configuring a bigger application might show that it may not be the best way to reduce the boilerplate
As for minimal API it seems that a lot of people are doing the same. Still in .NET 7, they introduces RouteGroups to create such pseudo-controllers and keep it a little bit more coherent
However, I think that it may not be ideal if you are defining endpoints in a single pseudo-controller and they all have specific configuration as for their routes / authorization / metadata / etc.
For further actions, you may consider blocking this person and/or reporting abuse
We're a blogging-forward open source social network where we learn from one another
Hey that's pretty cool, but honestly I don't mind the new setup. I just don't want everything in the one file. It's maybe cool for small projects or little things but when you're configuring logging, telemetry, swagger etc that
Program.cs
blows out quickly.I can easily create extension methods on the
WebApplicationBuilder
andWebApplication
in say aProgramExtensions.cs
file and I find it helps with that separation, just likeStartup.cs
did.Also not a huge fan of the minimal api setup, but if when implementing those, I'd use extension methods to separate out pseudo controllers too
I have to admit that you are right, the
Program.cs
does look like a good idea but the fact that it is blowing up when configuring a bigger application might show that it may not be the best way to reduce the boilerplateAs for minimal API it seems that a lot of people are doing the same. Still in .NET 7, they introduces
RouteGroups
to create such pseudo-controllers and keep it a little bit more coherentHowever, I think that it may not be ideal if you are defining endpoints in a single pseudo-controller and they all have specific configuration as for their routes / authorization / metadata / etc.