Headless.Core 0.4.15

dotnet add package Headless.Core --version 0.4.15
                    
NuGet\Install-Package Headless.Core -Version 0.4.15
                    
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="Headless.Core" Version="0.4.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Headless.Core" Version="0.4.15" />
                    
Directory.Packages.props
<PackageReference Include="Headless.Core" />
                    
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 Headless.Core --version 0.4.15
                    
#r "nuget: Headless.Core, 0.4.15"
                    
#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.
#:package Headless.Core@0.4.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Headless.Core&version=0.4.15
                    
Install as a Cake Addin
#tool nuget:?package=Headless.Core&version=0.4.15
                    
Install as a Cake Tool

Headless.Core

Core abstractions and utilities for building applications with multi-tenancy, user context, and cross-cutting concerns.

Problem Solved

Provides standardized interfaces for common cross-cutting concerns (clock, user, tenant, locale, timezone conversion) and utilities (retry logic, compression, structured logging) enabling consistent patterns across all application layers.

Key Features

  • Abstractions:

    • IClock - Testable time abstraction (wraps TimeProvider)
    • ICurrentUser - Current authenticated user context with roles and claims
    • ICurrentTenant - Multi-tenancy support with scoped tenant switching
    • ITenantWriteGuardBypass - Explicit bypass scope for audited host/admin tenant writes
    • CrossTenantWriteException - Non-transient exception for blocked tenant-owned writes
    • ICurrentLocale - Localization context (language, locale, culture)
    • ICurrentTimeZone - Timezone handling
    • ICurrentPrincipalAccessor - Scoped ClaimsPrincipal access with temporary switching
    • IPasswordGenerator - Configurable secure password generation
    • ICancellationTokenProvider - Cancellation token access with fallback logic
    • ITimezoneProvider - Windows/IANA timezone conversion and listing
    • IApplicationInformationAccessor / IBuildInformationAccessor - Application metadata and build info
    • IEnumLocaleAccessor - Localized enum display values
    • IHaveLogger / IHaveTimeProvider - Mixin interfaces for logger and time provider access
  • Utilities:

    • Run - Retry helper with exponential backoff (WithRetriesAsync, DelayedAsync)
    • SnappyCompressor - Snappy compression/decompression with JSON serialization (AOT-compatible)
    • LogState / LoggerExtensions - Structured logging with fluent state builder, tags, and scoped properties

Installation

dotnet add package Headless.Core

Quick Start

public sealed class OrderService(IClock clock, ICurrentUser user, ICurrentTenant tenant)
{
    public Order CreateOrder(CreateOrderRequest request)
    {
        return new Order
        {
            Id = Guid.NewGuid(),
            UserId = user.UserId!.Value,
            TenantId = tenant.Id,
            CreatedAt = clock.UtcNow,
            Total = new Money(request.Amount, request.Currency)
        };
    }
}

Structured Logging

logger.LogInformation(
    s => s.Tag("orders").Property("orderId", orderId),
    "Order {OrderId} created",
    orderId
);

Retry with Backoff

var result = await Run.WithRetriesAsync(
    async ct => await httpClient.GetAsync(url, ct),
    maxAttempts: 3,
    logger: logger
);

Configuration

No configuration required. Implementations are registered by Headless.Api or other host packages.

Dependencies

  • Headless.Checks
  • Headless.Extensions
  • Headless.Serializer.Json
  • Microsoft.Extensions.Logging.Abstractions
  • Snappier

Side Effects

None.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (7)

Showing the top 5 NuGet packages that depend on Headless.Core:

Package Downloads
Headless.Api.Abstractions

Package Description

Headless.Blobs.Azure

Package Description

Headless.Features.Core

Package Description

Headless.Api.Core

Package Description

Headless.Blobs.Aws

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.15 46 5/18/2026
0.4.14 58 5/18/2026