graydart.tools.appsettings_reader
1.0.2
dotnet add package graydart.tools.appsettings_reader --version 1.0.2
NuGet\Install-Package graydart.tools.appsettings_reader -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="graydart.tools.appsettings_reader" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="graydart.tools.appsettings_reader" Version="1.0.2" />
<PackageReference Include="graydart.tools.appsettings_reader" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add graydart.tools.appsettings_reader --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: graydart.tools.appsettings_reader, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=graydart.tools.appsettings_reader&version=1.0.2
#tool nuget:?package=graydart.tools.appsettings_reader&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AppSettings Reader Helper
Overview
AppSetting Reader
dotnet add package graydart.tools.appsettings_reader --version 1.0.2
Include
using AppSettings_Reader;
// Declare object (default directory:"./", Default filename: "appsettings.json")
var appSettingHelper=new Helper();
// Declare object specifying directory and file name
var appSettingHelper=new Helper("./","MyAppSettings.json");
App Setting or any Json file reader methods
//Read value by providing section and key
var appName=appSettingHelper.GetSettingsBySectionAndKey("App_Detail", "Name");
//Read value by providing section and key (dynamic object T)
var appName=appSettingHelper.GetSettingsBySectionAndKey<string>("App_Detail", "Name");
//Reads section as string
var appDetail=appSettinHelper.GetSettingsBySection("App_Detail");
//Reads section as class object (dynamic object)
AppDetail appDetail=appSettinHelper.GetSettingsBySection<AppDetail>("App_Detail");
// Reads key from "AppSettings" section and returns as string
var wlNumber=appSettingHelper.GetAppSettingsKeyValue("WL_NO")
// Reads key from "AppSettings" section and returns as dynamic type
var wlNumber=appSettingHelper.GetAppSettingsKeyValue<string>("WL_NO")
// Read connection string from app settings / json file , Default section "ConnectionStrings"
string connectionString=appSettingHelper.GetConnectionString("SQLConnString");
Sample file format (AppSettings.json)
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Log4Net": "Error"
}
},
"ConnectionStrings": {
"SQLConnString":"Data..."
},
"AppSettings":{
"WL_NO":"WL001"
},
"App_Detail":{
"Name":"MyApp"
}
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
This library is licensed under the MIT License. See the LICENSE file for more details.
Contributions
Contributions to this library are welcome. Please open an issue or submit a pull request with your changes
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.1)
- Microsoft.Extensions.Configuration.Json (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.