TaskHub.Shared

Configuration Tools

The TaskHub.Shared.ConfigurationTools module provides extension methods for IConfigurationSection to simplify and safely retrieve configuration values.

Selectors

The Selectors static class provides methods to get values with built-in validation. If a required value is missing or empty, it throws an InvalidOperationException.

Available Methods

Usage Example

public class MyServiceOptions
{
    public string ApiKey { get; init; }
    public int TimeoutSeconds { get; init; }

    public MyServiceOptions(IConfiguration configuration)
    {
        var section = configuration.GetSection("MyService");
        ApiKey = section.GetString("ApiKey");
        TimeoutSeconds = section.GetInt("TimeoutSeconds");
    }
}

Configuration Schema (Standard)

Modules in TaskHub.Shared typically follow this schema in appsettings.json:

{
  "Module": {
    "Enabled": true,
    "OptionA": "Value",
    "OptionB": 123
  }
}

Impact of Fields