From 60b0005908e3084273700d30cabec5b18c48245c Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Wed, 16 Nov 2022 20:01:00 -0500 Subject: [PATCH] Added a note to the explanatory section of the binder --- README.md | 2 ++ docs/articles/using_binder.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 1c155c4..1255e7f 100644 --- a/README.md +++ b/README.md @@ -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(); diff --git a/docs/articles/using_binder.md b/docs/articles/using_binder.md index f0675db..1348a22 100644 --- a/docs/articles/using_binder.md +++ b/docs/articles/using_binder.md @@ -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