Skip to content

Commit 60b0005

Browse files
committed
Added a note to the explanatory section of the binder
1 parent 5657291 commit 60b0005

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ class AppSettings
143143
```
144144
The `EnvKey` attribute is used in case the key names do not match the properties and this is because the key names in a .env file usually follow this convention: `KEY_NAME=VALUE` (UpperCase + SnakeCase).
145145

146+
> Note: As of version 2.3.0, it is no longer necessary to use the `EnvKey` attribute, because the binder performs an additional step: It converts the property name to UpperCaseSnakeCase and then checks if it exists in the environment. Note that this additional step only occurs if the `EnvKey` attribute is not used.
147+
146148
Then call the `EnvBinder.Bind` method to bind the `AppSettings` class with the configuration keys:
147149
```cs
148150
new EnvLoader().Load();

docs/articles/using_binder.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class AppSettings
1515
```
1616
The `EnvKey` attribute is used in case the key names do not match the properties and this is because the key names in a .env file usually follow this convention: `KEY_NAME=VALUE` (UpperCase + SnakeCase).
1717

18+
> Note: As of version 2.3.0, it is no longer necessary to use the `EnvKey` attribute, because the binder performs an additional step: It converts the property name to UpperCaseSnakeCase and then checks if it exists in the environment. Note that this additional step only occurs if the `EnvKey` attribute is not used.
19+
1820
In case the key names of a .env file match the properties, then it is not necessary to use the attribute (*or decorator*):
1921
```cs
2022
class AppSettings

0 commit comments

Comments
 (0)