Skip to content

Commit

Permalink
Added a note to the explanatory section of the binder
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 committed Nov 17, 2022
1 parent 5657291 commit 60b0005
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class AppSettings
```
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).

> 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.
Then call the `EnvBinder.Bind` method to bind the `AppSettings` class with the configuration keys:
```cs
new EnvLoader().Load();
Expand Down
2 changes: 2 additions & 0 deletions docs/articles/using_binder.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class AppSettings
```
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).

> 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.
In case the key names of a .env file match the properties, then it is not necessary to use the attribute (*or decorator*):
```cs
class AppSettings
Expand Down

0 comments on commit 60b0005

Please sign in to comment.