How to Organize Your ASP.NET Program.cs File

  Рет қаралды 6,101

Gui Ferreira

Gui Ferreira

Күн бұрын

Пікірлер: 17
@antonmartyniuk
@antonmartyniuk 2 ай бұрын
I really like the visuals you make in your videos
@gui.ferreira
@gui.ferreira 2 ай бұрын
Thank you, Anton 🙏 I put a lot of work into them, I hope they help.
@Tamer_Ali
@Tamer_Ali 2 ай бұрын
Thanks Gui, you awesome 👍.Keep going
@gui.ferreira
@gui.ferreira 2 ай бұрын
Thanks, will do!
@iliyan-kulishev
@iliyan-kulishev 2 ай бұрын
With regards to composing the features - are you a fan of defining some interface like IComposer { void Compose(IServiceCollection services)} which all the features implement and then finding the implementations via reflection in Program.cs ?
@gui.ferreira
@gui.ferreira 2 ай бұрын
I like it when I have many features built by different teams. By having the Interface I can dynamically discover features and avoid some conflicts. However, in my opinion, it often is an overkill.
@_iPilot
@_iPilot 2 ай бұрын
Back in days before .NET6 there was a Startup file which slightly helped, but for some reasons it was removed from application template.
@gui.ferreira
@gui.ferreira 2 ай бұрын
That’s true, but even on those days, it was a mess.
@icewolf1911
@icewolf1911 2 ай бұрын
Good work
@gui.ferreira
@gui.ferreira 2 ай бұрын
Thank you so much 😀
@codeDotnet
@codeDotnet 2 ай бұрын
Thanks
@gui.ferreira
@gui.ferreira 2 ай бұрын
Thanks for watching!
@cryptoeric24
@cryptoeric24 2 ай бұрын
This is NOT a waste of time!!!!!!!!!!!!!!!!!!!!!!!!!!
@cosorxndrw
@cosorxndrw 2 ай бұрын
So you're coupling your Features/UseCases and the project they're in (Application which is below Infrastructure) to your DbContext which is in the Infrastructure project. Isn't that a big NoNo, in the sense that arrows should point inwards?
@gui.ferreira
@gui.ferreira 2 ай бұрын
No, that's not the case. Your composition root (something like a web project) will have that dependency.
@GrzegorzGaezowski
@GrzegorzGaezowski 2 ай бұрын
devs: I want to use DI container over manual composition because it's declarative and flat, no methods, conditions, nesting etc. also devs: this declarative code looks bloated, let's extract some methods for better readability also devs: now that I extracted the methods, adding the same registration twice is more risky, let's add some if(registered) conditions inside these methods. Better yet, let's make a special "try" method for that. Btw the one thing this approach lacks compared to manual composition is that there is no encapsulation of objects between the "features". I could move a registration from one "feature" to another and everything would still work, no real boundaries. I find it much more powerful to model "modules" or "features" as objects (mini-composition roots), compose each of them manually and only make these objects expose the dependencies that are meant to be consumed by other "features" or "modules".
@gui.ferreira
@gui.ferreira 2 ай бұрын
I agree with most of your points. I like Modules to create structure and clear boundaries. However, in my experience, it's easier to convince developers to implement small improvements, because we are used to the traditional way of doing it. Thanks for sharing your thoughts! It brings an important perspective.
You Should Know This Before Using Page Numbers on Your API
10:45
Gui Ferreira
Рет қаралды 2,8 М.
Building better DTOs in C#
11:57
Gui Ferreira
Рет қаралды 7 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
The Logging Everyone Should Be Using in .NET
15:34
Nick Chapsas
Рет қаралды 89 М.
The Best Way To Organize Your Program.cs In ASP.NET
6:59
Amichai Mantinband
Рет қаралды 18 М.
Simple Tips to Effectively Apply Feature Folders
14:07
Gui Ferreira
Рет қаралды 2,6 М.
How to Stay Motivated When Learning How to Code
13:03
The Fullstack Bro
Рет қаралды 324
REST, gRPC, or GraphQL: Which Should You Use?
13:17
Gui Ferreira
Рет қаралды 4,2 М.
Building Complex Objects in a Simple Way with C#
12:19
Gui Ferreira
Рет қаралды 9 М.
ASP.NET Core Crash Course - C# App in One Hour
1:00:44
freeCodeCamp.org
Рет қаралды 1,6 МЛН
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 799 М.
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 691 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН