Cirreum.Core 1.0.40

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

Cirreum Core

NuGet Version NuGet Downloads GitHub Release License .NET

Foundational primitives and abstractions for the Cirreum Framework

Overview

Cirreum.Core is the foundational library of the Cirreum ecosystem. It provides the core abstractions, primitives, and shared patterns used across all Cirreum libraries and runtime components.

This is not the application's domain core. Instead, it acts as the framework coreβ€”the layer that defines the structural backbone of the entire stack.

All other Cirreum libraries (Conductor, Messaging, Authorization, Runtime, Components, and more) build directly on this project.

Purpose

Cirreum.Core exists to deliver a stable, consistent, and expressive foundation that:

  • Defines contracts and interfaces shared across the framework
  • Supplies lightweight primitives for contexts, identifiers, and pipelines
  • Hosts cross-cutting patterns such as CQRS contracts and authorization resources
  • Provides utilities supporting consistent behavior across the ecosystem

Its mission is to centralize building blocks that must be universally accessible and long-lived across all Cirreum packages.

Key Features

🎯 Context Architecture

A composable context system that provides single-source-of-truth operational context throughout your application:

  • OperationContext - Canonical WHO/WHEN/WHERE/TIMING information
  • RequestContext - Pipeline-aware request context with delegation
  • AuthorizationContext - Authorization decisions with effective roles
// Created once in the dispatcher
var operation = OperationContext.Create(
    userState, operationId, correlationId, startTimestamp);

// Composed into request context
var requestContext = new RequestContext<TRequest>(
    operation, request, requestType);

// Composed into authorization context
var authContext = new AuthorizationContext<TResource>(
    operation, effectiveRoles, resource);

See detailed context documentation

πŸ” Authorization Abstractions

Flexible, policy-based authorization with support for both RBAC and ABAC patterns:

  • IAuthorizationEvaluator - Pluggable authorization evaluation
  • IAuthorizableResource - Resources that can be authorized
  • IAuthorizationValidator - Custom authorization logic
  • Role resolution with inheritance support
  • Built-in Authorization visualizers and documenters
  • Flexible AuthN/AuthZ with support for OIDC/MSAL

πŸš€ Messaging & CQRS (Cirreum Conductor)

A high-performance mediator implementation with comprehensive pipeline support for command/query separation:

Core Features

  • Type-safe request/response contracts with Result<T> pattern
  • Automatic handler discovery and registration
  • Configurable intercept pipeline (validation, authorization, caching, telemetry)
  • Pub/sub notification system with multiple publishing strategies
  • OpenTelemetry integration with zero overhead when disabled

Request Abstractions

  • IRequest / IRequest<TResponse> - Base request contracts
  • IDomainCommand / IDomainCommand<TResponse> - Commands with auditing and authorization
  • IDomainQuery<TResponse> - Queries with auditing and authorization
  • IDomainCacheableQuery<TResponse> - Cacheable queries with automatic cache management

Built-in Intercepts

  • Validation - FluentValidation integration
  • Authorization - Resource and policy-based authorization
  • Performance Monitoring - Request timing and metrics
  • Query Caching - Automatic result caching with configurable providers

Extension Interfaces

  • IAuditableRequest / IAuditableRequest<T> - Automatic audit trail generation
  • IAuthorizableRequest / IAuthorizableRequest<T> - Authorization evaluation
  • ICacheableQuery<T> - Query result caching with sliding/absolute expiration

πŸ—οΈ Primitives & Utilities

Battle-tested building blocks:

  • High-precision timing with StartTimestamp
  • Environment and runtime context
  • Identity and user state abstractions
  • Correlation and operation tracking

Responsibilities

1. Cross-Framework Abstractions

Base interfaces and extensibility points for:

  • Messaging and dispatch behaviors (implemented by Cirreum.Conductor)
  • Authorization and evaluator pipelines
  • Environment and identity access
  • Plugin and integration boundaries

2. Core Primitives

Foundational building blocks including:

  • Context structures (OperationContext, RequestContext, AuthorizationContext)
  • Identifiers, markers, and metadata carriers
  • Base implementations for validators, handlers, and authorizable resources
  • High-precision timing infrastructure

3. Shared Patterns

Definitions that support Cirreum's architectural patterns:

  • CQRS-style request and response contracts
  • ABAC/RBAC authorization with role inheritance
  • Interceptors, pipelines, and execution flows
  • Metadata propagation and scoped request details
Interface Auth Audit Cache Use Case
IRequest<T> βœ— βœ— βœ— Internal/anonymous
IAuthorizableRequest<T> βœ“ βœ— βœ— Protected, no logging
IAuditableRequest<T> βœ— βœ“ βœ— Logged, open access
ICacheableQuery<T> βœ— βœ— βœ“ Public cached lookups
IAuthorizableCacheableQuery<T> βœ“ βœ— βœ“ Protected high-freq reads
IDomainQuery<T> βœ“ βœ“ βœ— Sensitive reads
IDomainCommand<T> βœ“ βœ“ βœ— State mutations
IDomainCacheableQuery<T> βœ“ βœ“ βœ“ Full coverage + cache

4. Utilities & Helpers

Common functionality implemented using a curated set of stable dependencies:

  • SmartFormat for formatting and templating
  • FluentValidation for rule-based validation
  • Humanizer for readable string and value transformations
  • CsvHelper for import/export workflows

Dependencies

Cirreum.Core is intentionally lightweight, but not dependency-free. It includes a small, stable set of critical foundational libraries:

  • Cirreum.Result - Railway-oriented programming with Result<T>
  • 'OpenTelemetry.Api' - OpenTelemetry support
  • 'OpenTelemetry.Extensions.Hosting' - OpenTelemetry support
  • Microsoft.Extensions.Telemetry.Abstractions - OpenTelemetry support
  • Microsoft.Extensions.Configuration.Json - Configuration management
  • Microsoft.Extensions.Configuration.Binder - Configuration binding
  • FluentValidation - Validation and Authorization rules
  • Humanizer.Core - Human-readable transformations
  • SmartFormat - String formatting
  • CsvHelper - CSV processing

These are framework-level dependencies chosen for stability, longevity, and ecosystem alignment.

Design Principles

🎨 Lightweight, Not Minimalist

Dependencies are curatedβ€”not avoided for their own sake. Each dependency provides significant value and is widely adopted in the .NET ecosystem.

πŸ”’ Stable and Forward-Compatible

The API surface here is foundational and should evolve slowly. Breaking changes are avoided whenever possible.

πŸ”Œ Extensible by Design

Every contract is intended to be implemented differently across runtimes or applications. Extensibility is a first-class concern.

βœ… Testability First

All primitives and abstractions are unit-test-friendly with minimal dependencies and clear interfaces.

⚑ Performance Conscious

Zero-allocation patterns where possible, computed properties over mutable state, and careful use of immutable records.

πŸ“Š Observable by Default

Built-in support for OpenTelemetry, structured logging, and distributed tracing through context propagation.

Architecture

Context Composition

OperationContext (Single Source of Truth)
    β”œβ”€> WHO: UserState, UserId, UserName, TenantId, Roles
    β”œβ”€> WHEN: Timestamp, StartTimestamp, Elapsed
    β”œβ”€> WHERE: Environment, RuntimeType
    └─> TIMING: High-precision duration calculation

RequestContext (Pipeline Context)
    β”œβ”€> Composes: OperationContext
    β”œβ”€> Adds: Request, RequestType
    └─> Delegates: All user/timing properties to Operation

AuthorizationContext (Authorization Decisions)
    β”œβ”€> Composes: OperationContext
    β”œβ”€> Adds: EffectiveRoles, Resource
    └─> Delegates: All user properties to Operation

Zero-Allocation Timing

// Captured once at operation start
long startTimestamp = Stopwatch.GetTimestamp();

// Computed on demand, zero allocation
TimeSpan elapsed = operation.Elapsed;
double milliseconds = operation.ElapsedMilliseconds;

// Available throughout pipeline via delegation
TimeSpan requestElapsed = requestContext.ElapsedDuration;

Authorization Flow

// Ad-hoc authorization (creates context)
var result = await evaluator.Evaluate(resource);

// Pipeline authorization (reuses context)
var result = await evaluator.Evaluate(resource, operationContext);

// Validators receive canonical AuthorizationContext
public class MyValidator : IAuthorizationValidator<MyResource>
{
    public Task<Result> Validate(
        AuthorizationContext<MyResource> context,
        CancellationToken ct)
    {
        // Access user, roles, resource, timing all in one place
        if (context.IsAuthenticated && 
            context.EffectiveRoles.Contains(requiredRole))
        {
            return Result.Success();
        }
        return Result.Failure("Unauthorized");
    }
}

Logical Structure

Cirreum.Core/
β”œβ”€β”€ Abstractions/
β”‚   β”œβ”€β”€ Authorization/        # IAuthorizationEvaluator, IAuthorizableResource
β”‚   β”œβ”€β”€ Identity/             # IUserState, IUserStateAccessor
β”‚   β”œβ”€β”€ Messaging/            # Request/response contracts
β”‚   └── Environment/          # Runtime and environment abstractions
β”œβ”€β”€ Contexts/
β”‚   β”œβ”€β”€ OperationContext.cs   # Canonical operational context
β”‚   β”œβ”€β”€ RequestContext.cs     # Pipeline request context
β”‚   └── AuthorizationContext.cs # Authorization decision context
β”œβ”€β”€ Primitives/
β”‚   β”œβ”€β”€ Identifiers/          # Operation IDs, correlation IDs
β”‚   β”œβ”€β”€ Markers/              # Interface markers and tags
β”‚   └── Metadata/             # Context metadata carriers
β”œβ”€β”€ Patterns/
β”‚   β”œβ”€β”€ Validators/           # Base validator implementations
β”‚   β”œβ”€β”€ Interceptors/         # Pipeline interceptor patterns
β”‚   └── Resources/            # Authorizable resource models
└── Utilities/
    β”œβ”€β”€ Formatting/           # SmartFormat helpers
    β”œβ”€β”€ Validation/           # FluentValidation extensions
    └── Csv/                  # CSV import/export utilities

Usage

Installation

dotnet add package Cirreum.Core

Basic Context Usage

// 1. Create operation context (done once in dispatcher)
var operation = OperationContext.Create(
    userState: currentUserState,
    operationId: Guid.NewGuid().ToString(),
    correlationId: Activity.Current?.TraceId.ToString() ?? Guid.NewGuid().ToString(),
    startTimestamp: Stopwatch.GetTimestamp()
);

// 2. Use in request pipeline
var requestContext = RequestContext<MyRequest>.Create(
    userState: currentUserState,
    request: myRequest,
    requestType: nameof(MyRequest),
    requestId: operation.OperationId,
    correlationId: operation.CorrelationId,
    startTimestamp: operation.StartTimestamp
);

// 3. Access context throughout pipeline
logger.LogInformation(
    "Processing {RequestType} for user {UserId} - {Elapsed}ms",
    requestContext.RequestType,
    requestContext.UserId,
    requestContext.ElapsedDuration.TotalMilliseconds
);

Authorization

// Define authorizable resource
public record DocumentResource : IAuthorizableResource
{
    public required string DocumentId { get; init; }
    public required string OwnerId { get; init; }
}

// Create validator
public class DocumentAccessValidator 
    : IAuthorizationValidator<DocumentResource>
{
    public Task<Result> Validate(
        AuthorizationContext<DocumentResource> context,
        CancellationToken ct)
    {
        // Owner can always access
        if (context.Resource.OwnerId == context.UserId)
            return Task.FromResult(Result.Success());

        // Admins can access
        if (context.EffectiveRoles.Any(r => r.Name == "Admin"))
            return Task.FromResult(Result.Success());

        return Task.FromResult(
            Result.Failure("You don't have permission to access this document"));
    }
}

// Evaluate authorization
var resource = new DocumentResource 
{ 
    DocumentId = "doc-123", 
    OwnerId = "user-456" 
};

var result = await authEvaluator.Evaluate(resource, operationContext);
if (result.IsFailure)
{
    return Forbid(result.Error);
}

Integration with Cirreum Ecosystem

Every other Cirreum library depends on Cirreum.Core:

  • Cirreum.Conductor - Implements messaging abstractions with CQRS patterns
  • Cirreum.Authorization - Provides default authorization evaluators
  • Cirreum.Runtime - Supplies runtime-specific implementations
  • Cirreum.Components - Builds on primitives for UI components
  • Cirreum.Messaging - Extends messaging contracts for events/notifications

This library:

  • Defines the shared vocabulary of the framework
  • Establishes conventions for request handling, authorization, and behaviors
  • Acts as the foundational contract layer between domain-agnostic logic and implementation-specific libraries

Documentation

Contribution Guidelines

  1. Be conservative with new abstractions
    The API surface must remain stable and meaningful.

  2. Limit dependency expansion
    Only add foundational, version-stable dependencies.

  3. Favor additive, non-breaking changes
    Breaking changes ripple through the entire ecosystem.

  4. Include thorough unit tests
    All primitives and patterns should be independently testable.

  5. Document architectural decisions
    Context and reasoning should be clear for future maintainers.

  6. Follow .NET conventions
    Use established patterns from Microsoft.Extensions.* libraries.

Versioning

Cirreum.Core follows Semantic Versioning:

  • Major - Breaking API changes
  • Minor - New features, backward compatible
  • Patch - Bug fixes, backward compatible

Given its foundational role, major version bumps are rare and carefully considered.

License

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

Support


Cirreum Foundation Framework
Layered simplicity for modern .NET

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 (14)

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

Package Downloads
Cirreum.Services.Client

The Services Infrastructure Library for WebAssembly Client applications.

Cirreum.Persistence.Azure

Persistence Library using Azure Cosmos DB for NoSQL.

Cirreum.Services.Server

The Service Library for Servers (Web Api or Web App).

Cirreum.Runtime.Authorization

The Runtime Authorization configuration.

Cirreum.Graph.Provider

The MsGraph provider for the Cirreum foundation

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.40 309 2/4/2026
1.0.39 410 1/23/2026
1.0.38 188 1/22/2026
1.0.37 300 1/21/2026
1.0.36 285 1/12/2026
1.0.35 343 1/10/2026
1.0.34 267 1/5/2026
1.0.33 255 1/5/2026
1.0.32 97 1/3/2026
1.0.31 98 1/3/2026
1.0.30 306 1/2/2026
1.0.29 250 12/31/2025
1.0.28 256 12/30/2025
1.0.27 244 12/29/2025
1.0.26 232 12/29/2025
1.0.25 190 12/29/2025
1.0.24 183 12/29/2025
1.0.23 367 12/22/2025
1.0.22 260 12/20/2025
1.0.21 558 12/16/2025
Loading failed