amantinband / clean-architecture

The ultimate clean architecture template for .NET applications 💪
MIT License
1.4k stars 221 forks source link

A slight change in Bind Configuration #9

Closed ducware closed 7 months ago

ducware commented 7 months ago

What do you think if you change: Your code:

configuration.Bind(EmailSettings.Section, emailSettings);

The code becomes like this:

configuration.Bind(nameof(EmailSettings), emailSettings);

Similar to other settings, this will probably be more flexible for code, I think, have a nice day!

amantinband commented 7 months ago

Hey Dang!

I prefer not to couple the EmailSettings class with the configuration section. I usually go with either what we currently have:

image

Or inlining the section name like so:

configuration.Bind("EmailSection", emailSettings);

Your approach is also very common, it's mostly a matter of taste