Hexalith.Commons.Configurations 2.0.1

dotnet add package Hexalith.Commons.Configurations --version 2.0.1
                    
NuGet\Install-Package Hexalith.Commons.Configurations -Version 2.0.1
                    
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="Hexalith.Commons.Configurations" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hexalith.Commons.Configurations" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Hexalith.Commons.Configurations" />
                    
Project file
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 Hexalith.Commons.Configurations --version 2.0.1
                    
#r "nuget: Hexalith.Commons.Configurations, 2.0.1"
                    
#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=Hexalith.Commons.Configurations&version=2.0.1
                    
Install Hexalith.Commons.Configurations as a Cake Addin
#tool nuget:?package=Hexalith.Commons.Configurations&version=2.0.1
                    
Install Hexalith.Commons.Configurations as a Cake Tool

Hexalith.Commons

A comprehensive .NET utility library providing common functionality for Hexalith projects.

License: MIT Discord

Coverity Scan Build Status Codacy Badge Quality Gate Status Security Rating Maintainability Rating Code Smells Lines of Code Technical Debt Reliability Rating Duplicated Lines (%) Vulnerabilities Bugs

Build Status

Stable (version tag):

Build status NuGet Latest

Overview

Hexalith.Commons is a collection of utility classes, helpers, and extensions designed to support development across Hexalith projects. This library provides consistent and reusable components for handling common programming tasks.

Packages

The Hexalith.Commons solution includes several NuGet packages:

  • Hexalith.Commons: The core utility library with a wide range of helpers and extensions
  • Hexalith.Commons.Configurations: Utilities for handling configuration settings in .NET applications
  • Hexalith.Commons.StringEncoders: Utilities for encoding and decoding strings to be RFC 1123 compliant
  • Hexalith.Commons.UniqueIds: Utilities for generating unique identifiers in various formats

Features

The library is organized into several key utility areas:

Assemblies

Utilities for working with .NET assemblies and reflection-based operations.

Common

General purpose utilities and helpers that don't fit into specific categories.

Configuration

Tools and extensions for managing application configuration:

  • ISettings interface for strongly-typed settings
  • Configuration validation using FluentValidation
  • Helper methods for registering and validating configuration
  • Settings exception handling

Dates

Date and time manipulation utilities.

Errors

Error handling, custom exceptions, and error management utilities.

Loggings

Extensions and helpers for consistent logging across applications.

Maths

Mathematical utility functions and extensions.

Objects

Object manipulation, comparison, and conversion utilities.

Reflections

Reflection-based utilities for working with types, properties, and methods at runtime.

Strings

String manipulation utilities:

  • Format strings with named placeholders
  • RFC1123 compliance checking and encoding/decoding
  • Culture-invariant string conversions
  • String to number conversions with proper culture handling
  • Reversible encoding of arbitrary strings to RFC1123 compliant format

Tests

Testing helpers and utilities to simplify unit and integration tests.

Getting Started

Prerequisites

  • .NET 8.0 or higher

Installation

You can add this library to your project using NuGet:

dotnet add package Hexalith.Commons

Usage Examples

String Utilities

using Hexalith.Extensions.Helpers;

// Convert a string to an integer using invariant culture
string numberStr = "42";
int number = numberStr.ToInteger();

// Check if a hostname is RFC 1123 compliant
bool isValid = "valid-host.example.com".IsRfc1123Compliant();

RFC1123 String Encoding

using Hexalith.Commons.StringEncoders;

// Encode a string to be RFC 1123 compliant
string original = "Hello World! 你好世界";
string encoded = original.ToRFC1123();
// Result: "Hello_20World_21_20_E4_BD_A0_E5_A5_BD_E4_B8_96_E7_95_8C"

// Decode back to the original string
string decoded = encoded.FromRFC1123();
// Result: "Hello World! 你好世界"

Configuration utilities

// Define settings class
public class MySettings : ISettings
{
  public string? FirstName { get; set; }
  public string? LastName { get; set; }
  public static string ConfigurationName() => "Me";    
}

// In startup code
services.ConfigureSettings<MySettings>(configuration);

// In a service
public class MyService
{
  private readonly IOptions<MySettings> _settings;

  public MyService(IOptions<MySettings> settings)
  {
    _settings = settings;
  }
}

Building and Testing

The project uses standard .NET build tools and practices:

dotnet build
dotnet test

CI/CD

The repository includes GitHub Actions workflows for:

  • Building and testing the code
  • Publishing NuGet packages
  • Version management

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Hexalith.Commons.Configurations:

Package Downloads
Hexalith.DaprIdentityStore.Abstractions

Hexalith is a set of libraries to build a micro-service architecture.

Hexalith.Security.Application

Hexalith is a set of libraries to build an application with micro-service architecture.

Hexalith.KeyValueStorages.Abstractions

Hexalith KeyValueStorages utilities and helpers

Hexalith.IdentityStores.Abstractions

Hexalith is a set of libraries to build an application with micro-service architecture.

Hexalith.KeyValueStorages.Files

Hexalith KeyValueStorages utilities and helpers

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 229 6/13/2025
2.0.0 222 6/13/2025
1.66.5 721 4/11/2025
1.66.4 185 4/10/2025
1.66.3 293 4/9/2025
1.66.2 163 4/8/2025
1.66.1 131 4/8/2025
1.66.0 132 4/7/2025
1.65.1 132 4/6/2025
1.65.0 135 4/6/2025
1.64.0 351 4/2/2025
1.0.0 132 4/2/2025