Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 2.15 KB

File metadata and controls

82 lines (60 loc) · 2.15 KB

Configuration manager

Build Release License: MIT Nuget Nuget

Common interface to access to configurations value.

How to install

Package Manager

Install-Package microservice.toolkit.configuration.extensions -Version 2.1.0

.NET CLI

dotnet add package microservice.toolkit.configuration.extensions --version 2.1.0

Package Reference

<PackageReference Include="microservice.toolkit.configuration.extensions" Version="2.1.0" />

Available methods

GetBool(string)

bool GetBool(string key);

Tries to retrieve the boolean value of the entry with key. Returns false if not exists.

GetString(string)

string GetString(string key);

Tries to retrieve the string value of the entry with key. Returns null if not exists.

GetInt(string)

int GetInt(string key);

Tries to retrieve the integer value of the entry with key. Returns 0 if not exists.

GetStringArray(string)

string[] GetStringArray(string key);

Tries to retrieve the value (array of string) of the entry with key. Returns default value if not exists.

GetIntArray(string)

int[] GetIntArray(string key);

Tries to retrieve the value (int of string) of the entry with key. Returns default value if not exists.

Implementations

Microsoft extensions configuration

using microservice.toolkit.configuration.extensions.extension;

IConfiguration configuration = ...;

var stringValue = configuration.GetString("stringValue");