Trellis.ServiceDefaults 3.0.0-alpha.721

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

Trellis.ServiceDefaults

NuGet Package

An ordered composition root for Trellis services. Configure authorization, validation, EF Core transactions, outbox, inbox, idempotency, and integration events in one fluent call.

Installation

dotnet add package Trellis.ServiceDefaults

Quick Example

using Trellis.ServiceDefaults;

builder.Services.AddTrellis(trellis => trellis
    .UseAsp()
    .UseScalarValueValidation()
    .UseProblemDetails()
    .UseMediator()
    .UseFluentValidation(typeof(Program).Assembly)
    .UseClaimsActorProvider()
    .UseResourceAuthorization(typeof(Program).Assembly)
    .UseEntityFrameworkUnitOfWork<AppDbContext>());

Call AddTrellis(...) once. If omitted, the composition features are intentionally not registered.

UseInsideTransactionBehavior<TMessage,TResponse,TBehavior>() or UseInsideTransactionBehavior(typeof(RequiredAuditBehavior<,>)) implies UseMediator() and registers an application-owned behavior inside the transaction scope, before the handler. Its post-handler work finishes before the commit decision, independent of fluent/direct registration order. Register IUnitOfWork separately, typically with UseEntityFrameworkUnitOfWork<TContext>().

Identical bindings deduplicate; behaviors nest in selection order and unwind in reverse order. Applications own recorder state, result checks, and cleanup. A returned ordinary failure skips this invocation's commit, without rollback or permanent rejection of an outer/later commit. See the same-commit audit recipe for the complete checkpoint pattern.

Key Features

  • Applies Trellis registrations in canonical pipeline order.
  • Existing Mediator/resource slots automatically install the dispatch authorization context: static/resource stages and actor-aware handlers share one checked Actor reference. No new actor-handler toggle is needed.
  • Keeps feature selection explicit and discoverable at the application composition root.
  • Provides slots for ASP.NET Core, authorization, FluentValidation, EF Core unit of work, outbox, inbox, idempotency, and events.
  • Preserves package-specific options through focused UseXxx(...) methods.
  • Existing actor/cache/worker slots preserve identity-only resolution. Supported UseCachingActorProvider<T>() binds both contracts to one scoped wrapper with independent lazy caches; custom providers/subclasses opt in explicitly.
  • Leaves vendor stores and transport adapters in their owning packages, avoiding unnecessary SDK dependencies.

For most applications, use the builder instead of mixing standalone AddTrellis* calls. Provider-specific stores and adapters remain separate registrations by design.

Every UseIntegrationEvents(...) overload wires the default best-effort local publisher when none is registered. It logs and swallows ordinary consumer failures, so processed integration outbox rows do not retry those consumers. For reliable broker handoff, replace the publisher with an adapter that awaits acceptance and propagates publication failures; acceptance is not consumer success. UseInbox<TContext>() supplies a separate non-swallowing consumption seam, not automatic routing: an adapter must call IInboxDispatcher.DispatchAsync with the stable message id and expose failures for redelivery.

See the complete producer/consumer compositions. Transport registrations stay direct so ServiceDefaults does not acquire a vendor SDK.

UseOutboxReadiness<TContext>(OutboxReadinessOptions.CreateStagedOperationalProfile()) explicitly enables the named trellis-outbox read-only health check alongside UseOutbox<TContext>(). Existing outbox/inbox slots do not enable it. Endpoint authorization and traffic-readiness versus alerting remain host-owned. Durable capture age is enabled on the same immutable profile after its nullable schema migration. Optional consumer lag uses the same slot: register an application-owned IConsumerLagProvider directly and select ConsumerLagMeasures.Age, Count, or both. The provider is a leaf adapter, not another builder feature. See outbox readiness.

For a separate worker, pass OutboxReadinessOptions.CreateMetadataOnlyProfile(workerMaxAttempts) to the same slot in the API, without UseOutbox. Match WorkerMaxAttempts to the worker's retry policy using one configuration key. Local options are ignored without comparison or warning. Metadata-only can evaluate enabled capture age but does not observe remote worker responsiveness. Generic Host lifecycle startup validates local-mode relay configuration before services start; bare service providers do not run that validation.

Common HttpContext.PageUrl(...) builders require no versioning SDK. Versioned hosts install Trellis.Asp.ApiVersioning and configure the existing UseAsp(asp => asp.UseVersionedPageUrls()) callback alongside normal API-versioning registration; ServiceDefaults itself remains versioning-independent.

Native AOT hosts with struct Result<T> responses need the literal closed-generator pipeline and direct typed resource registrations, without UseMediator or slots that imply it: native DI cannot dynamically close open behaviors over value-type responses.

Documentation

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-alpha.721 78 11/15/2026
3.0.0-alpha.582 86 10/19/2026
3.0.0-alpha.574 227 10/14/2026
3.0.0-alpha.571 74 10/13/2026
3.0.0-alpha.557 105 10/8/2026
3.0.0-alpha.554 74 10/8/2026
3.0.0-alpha.553 65 10/7/2026
3.0.0-alpha.542 132 10/5/2026
3.0.0-alpha.539 71 10/4/2026
3.0.0-alpha.532 70 10/2/2026
3.0.0-alpha.527 65 10/1/2026
3.0.0-alpha.526 72 9/30/2026
3.0.0-alpha.524 68 9/27/2026
3.0.0-alpha.520 71 9/25/2026
3.0.0-alpha.516 159 9/22/2026
3.0.0-alpha.513 69 9/22/2026
3.0.0-alpha.505 74 9/13/2026
3.0.0-alpha.495 140 8/24/2026
3.0.0-alpha.458 120 8/19/2026
3.0.0-alpha.455 134 8/19/2026
Loading failed