{"id":22508095,"url":"https://github.com/gucu112/configurationhelper","last_synced_at":"2026-04-28T08:39:16.592Z","repository":{"id":116725962,"uuid":"104372054","full_name":"gucu112/ConfigurationHelper","owner":"gucu112","description":"Extended configuration library for .NET framework.","archived":false,"fork":false,"pushed_at":"2019-09-10T21:38:00.000Z","size":85,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T23:44:50.279Z","etag":null,"topics":["config","configuration","configuration-management","csharp","dot-net","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gucu112.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-21T16:26:26.000Z","updated_at":"2024-09-28T17:12:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"a09527d9-32c6-4237-ab93-d5222dde78a2","html_url":"https://github.com/gucu112/ConfigurationHelper","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gucu112%2FConfigurationHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gucu112%2FConfigurationHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gucu112%2FConfigurationHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gucu112%2FConfigurationHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gucu112","download_url":"https://codeload.github.com/gucu112/ConfigurationHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944062,"owners_count":20697948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","configuration","configuration-management","csharp","dot-net","dotnet"],"created_at":"2024-12-07T01:18:10.174Z","updated_at":"2026-04-28T08:39:16.560Z","avatar_url":"https://github.com/gucu112.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConfigurationHelper\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003cimg src=\"ConfigurationHelperIcon.svg\" alt=\"ConfigurationHelper\" width=\"256\" height=\"256\" /\u003e\r\n    \u003cbr /\u003e\u003cstrong\u003eExtended configuration library for .NET framework.\u003c/strong\u003e\r\n\u003c/p\u003e\r\n\r\n## Key Features\r\n\r\n- No third-party dependencies, only `System.Configuration` reference is used,\r\n- Replaces default `ConfigurationManager` static class,\r\n- Extends `KeyValueConfigurationCollection` in order to get casted values (including enums) expanded by environment variables,\r\n- Standard `AppSettings` and `ConnectionStrings` properties available with extended behavior,\r\n- Possibility to use additional section `\u003cdataSettings\u003e` implemented as `AppSettingsSection` class,\r\n- Adds brand new `\u003cappData\u003e` section implemented as `AppDataSecion` which can store `List`s and `Dictionary`ies,\r\n- Example program and tests (both acceptance and units).\r\n\r\n## Installation\r\n\r\nThe ready to use library (stable release build) can be downloaded via NuGet package manager and found in [NuGet gallery](https://www.nuget.org/packages/ConfigurationHelper). Source code for all released versions can be found on [GitHub](https://github.com/gucu112/ConfigurationHelper/releases).\r\n\r\n## Code Examples\r\n\r\n##### Configuration entry gathering\r\n\r\nLibrary can be used for acquiring configuration data using standard syntax or function `Get()` as follows:\r\n```csharp\r\n// Get string value using standard syntax (not extended by environment variables)\r\nstring lang = ConfigurationManager.AppSettings[\"Language\"];\r\n\r\n// Get string value (extended by environment variables)\r\nstring env = ConfigurationManager.AppSettings.Get(\"ApplicationEnvironment\");\r\n```\r\n\r\nIn case if you use 2nd option then the configuration entry result value will be expanded by environment variables.\r\n\r\n##### Environment variables usage\r\n\r\nYou can use environment variables in you configuration file like this:\r\n```xml\r\n\u003cappSettings\u003e\r\n    \u003cadd key=\"ApplicationEnvironment\" value=\"%ENV%\" /\u003e\r\n\u003c/appSettings\u003e\r\n```\r\n\r\nIn case if your key value for the configuration entry will be equal to the environment variable name:\r\n```xml\r\n\u003cappSettings\u003e\r\n    \u003cadd key=\"CaseSensitivityIsIgnored\" value=\"%caseSensItIvItyIsIGNORED%\" /\u003e\r\n    \u003cadd key=\"SnakeCaseStyleIsAlsoSupported\" value=\"%SNAKE_CASE_STYLE_IS_ALSO_SUPPORTED%\" /\u003e\r\n\u003c/appSettings\u003e\r\n```\r\n\r\nThen it will be automatically resolved as `null` return value:\r\n```csharp\r\nAssert.Null(ConfigurationManager.AppSettings.Get(\"CaseSensitivityIsIgnored\"));\r\nAssert.Null(ConfigurationManager.AppSettings.Get(\"SnakeCaseStyleIsAlsoSupported\"));\r\n```\r\n\r\n##### Generic gathering function\r\n\r\nGeneric version of `Get\u003cT\u003e()` function automatically casts the value specified by a configuration key:\r\n```csharp\r\nfloat limit = ConfigurationManager.DataSettings.Get\u003cfloat\u003e(\"CapacityLimit\");\r\n```\r\n\r\nAs well as regular types also enums can be automatically casted based on string or numeric value:\r\n```csharp\r\npublic enum Place\r\n{\r\n    First = 1,\r\n    Second = 2,\r\n    Third = 3\r\n}\r\n```\r\n```xml\r\n\u003cappSettings\u003e\r\n    \u003cadd key=\"Winner\" value=\"First\" /\u003e\r\n    \u003cadd key=\"LastPlace\" value=\"3\" /\u003e\r\n\u003c/appSettings\u003e\r\n```\r\n```csharp\r\nAssert.Equal(Place.First, ConfigurationManager.AppSettings.Get\u003cPlace\u003e(\"Winner\"));\r\nAssert.Equal(Place.LastPlace, ConfigurationManager.AppSettings.Get\u003cPlace\u003e(\"LastPlace\"));\r\n```\r\n\r\n##### Additional configuration sections\r\n\r\nExcept default configuration section you can use additional ones defined at the beginning of your `App.config` file:\r\n```xml\r\n\u003cconfigSections\u003e\r\n    \u003csection name=\"serverSettings\" type=\"System.Configuration.AppSettingsSection\" /\u003e\r\n    \u003csection name=\"dataSettings\" type=\"System.Configuration.AppSettingsSection\" /\u003e\r\n    \u003csection name=\"appData\" type=\"Gucu112.ConfigurationHelper.Sections.AppData.AppDataSection, ConfigurationHelper\" /\u003e\r\n\u003c/configSections\u003e\r\n```\r\n\r\nValues stored in `\u003cappData\u003e` section can be multiple and collected using following methods:\r\n```csharp\r\n// Get list of strings\r\nIList\u003cstring\u003e fruits = ConfigurationManager.AppDataSection.GetList(\"FruitsList\");\r\n\r\n// Get list of casted values\r\nIList\u003cdouble\u003e numbers = ConfigurationManager.AppDataSection.GetList\u003cdouble\u003e(\"AcceptedNumbers\");\r\n\r\n// Get dictionary of strings\r\nIDictionary\u003cstring, string\u003e redirects = ConfigurationManager.AppDataSection.GetDictionary(\"RedirectionTable\");\r\n\r\n// Get dictionary of casted values\r\nIDictionary\u003cstring, int\u003e mapping = ConfigurationManager.AppDataSection.GetDictionary\u003cint\u003e(\"WordToNumberMapping\");\r\n```\r\n\r\n## Tests\r\n\r\nIn order to run tests you just need to open Visual Studio, navigate to \"Test Explorer\" window and simply click \"Run All\". If you don't want to run all the tests at once you can mark several of them, right-click on one of them and then choose either \"Run Selected Tests\" or \"Debug Selected Tests\".\r\n\r\n## Authors\r\n\r\n- **Bartlomiej Roszczypala** - [Gucu112](https://github.com/Gucu112)\r\n\r\nSee also the list of [contributors](https://github.com/Gucu112/ConfigurationHelper/contributors) who participated in this project.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\r\n\r\n## Changelog\r\n\r\n- v0.5.4\r\n  - Special check whether null should be returned for environment variable\r\n  - Enum conversion feature\r\n  - Updates acceptance tests\r\n  - Added test data in App.config file\r\n  - Updates examples in ConfigurationRunner\r\n  - Updates documentation\r\n  - Updates namespace names\r\n  - Refactor functions and variables names\r\n  - Simplify member access\r\n  - Updates README.md\r\n  - Updates year in files header\r\n  - Updates assembly version\r\n\r\n- v0.5.3\r\n  - Moves KeyValueConfigurationExtensions into ConfigurationSettingsCollection\r\n  - Updates README.md\r\n  - Updates year in *.nuspec and LICENSE file\r\n  - Updates assemblies info\r\n\r\n- v0.5.2\r\n  - Feature: ConfigurationHelperDeploy batch file\r\n  - Fix: Image size and positioning for GitHub README.md file\r\n  - Updates README.md\r\n  - Updates *.nuspec icon file path\r\n  - Updates assembly version\r\n\r\n- v0.5.1\r\n  - Feature: ServerSettings section\r\n  - Overall refactoring to enforce a set of style and consistency rules\r\n  - Extracts ProgramExamples class\r\n  - Changes class names in ConfigurationHelperTest\r\n  - Changes in configuration file\r\n  - Removes AssemblyReleaseNotesAttribute class\r\n  - Updates unit \u0026 acceptance tests\r\n  - Updates README.md\r\n  - Updates *.nuspec file\r\n  - Updates icon file\r\n  - Updates examples in ConfigurationRunner\r\n  - Updates assemblies info\r\n  - Updates documentation\r\n\r\n- v0.5.0\r\n  - Feature: Adds AssemblyReleaseNotesAttribute class\r\n  - Feature: Adds ConfigurationSettingsCollection class\r\n  - Fix: Adds null check for indexer in ConfigurationSettingsCollection class\r\n  - Downgrades ConfigurationHelper project .NET framework version to v4.5 for backwards compatibility\r\n  - Downgrades test and runner projects .NET framework version to v4.6\r\n  - Changes main class from Config to ConfigurationManager\r\n  - Use auto property refactoring\r\n  - Use pattern matching refactoring\r\n  - Use explicit type refactoring\r\n  - Updates *.nuspec file\r\n  - Updates README.md\r\n  - Updates dependencies\r\n  - Updates assemblies info\r\n  - Removes unnecessary references\r\n\r\n- v0.4.0\r\n  - Feature: AppData section\r\n  - Feature: Conversion from KeyValueConfigurationCollection to list of strings\r\n  - Changes in App.config file\r\n  - Minor naming convention changes\r\n  - Adds *.nuspec file\r\n  - Adds icon file\r\n  - Updates README.md \u0026 LICENSE files\r\n  - Updates .gitignore\r\n  - Updates acceptance tests\r\n  - Updates examples in ConfigurationRunner\r\n  - Updates assemblies info\r\n  - Updates documentation\r\n\r\n- v0.3.1\r\n  - Config class refactoring\r\n  - Changes namespace naming convention\r\n  - Upgrades projects .NET Framework version to v4.7\r\n  - Updates ConfigurationRunner examples\r\n  - Updates acceptance tests\r\n  - Updates documentation\r\n  - Updates dependencies\r\n  - Updates assemblies info\r\n\r\n- v0.3.0\r\n  - Feature: Expanding configuration data by environment variables \r\n  - Updates unit \u0026 acceptance tests \r\n  - Updates assemblies info\r\n\r\n- v0.2.1 and lower\r\n  - Feature: Data settings property\r\n  - Feature: Acceptance tests within ConfigurationRunner\r\n  - Feature: Data settings AppData alias\r\n  - Feature: NameValueCollection get function extension\r\n  - Fix: Resolves ConfigurationHelperTest references issues\r\n  - Upgrades projects .NET Framework version to v4.6.1\r\n  - Updates acceptance \u0026 unit tests\r\n  - Updates examples in ConfigurationRunner\r\n  - Updates assemblies info\r\n  - Changes in configuration file\r\n  - Adds documentation\r\n  - Adds regions\r\n  - Removes unnecessary usings\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgucu112%2Fconfigurationhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgucu112%2Fconfigurationhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgucu112%2Fconfigurationhelper/lists"}