SmartPipe.Extensions.Mapster 2.2.1

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

SmartPipe.Extensions.Mapster

Mapster object-mapping transforms for SmartPipe.Core with composition-time configuration isolation.

Installation

dotnet package add SmartPipe.Extensions.Mapster

What this package owns

  • MapsterPipelineComponents.Transform<TInput,TOutput>(Action<TypeAdapterConfig>? configure = null) — a runtime-owned PipelineComponent<IPipelineTransformer<TInput,TOutput>> over one compiled root mapping.
  • MapsterPipelineDefinitionBuilderExtensions.MapWithMapster<TInput,TOutput> — attaches that stage to an initial PipelineDefinitionBuilder<TInput>.
  • MapsterPipelineDefinitionBuilderExtensions.MapWithMapster<TPipelineInput,TCurrent,TOutput> — attaches the same stage after an existing stage while preserving the original pipeline input type.

The package depends only on SmartPipe.Core and Mapster. It never references SmartPipe.Extensions, dependency injection, Entity Framework Core, Dapper, HTTP, Polly, Mapster.DependencyInjection, Mapster.EFCore, Mapster.Async, Mapster.Tool, or FastExpressionCompiler. The composition entry points above take a configuration callback: there is no overload accepting a caller-owned mutable TypeAdapterConfig and no options type. The forwarded legacy MapsterTransform<TInput,TOutput> keeps its own shipped TypeAdapterConfig? constructor.

Composition and configuration isolation

Composition follows one fixed sequence for the requested root pair:

new working TypeAdapterConfig
  -> invoke configure once (when supplied)
  -> clone once into a private configuration container
  -> eagerly compile/cache the exact TInput -> TOutput pair once
  -> capture the resulting Func<TInput,TOutput>
Concern Contract
Callback configure runs exactly once during composition against the working configuration. An exception thrown there is a composition failure; it is never converted into an item failure.
Global settings TypeAdapterConfig.GlobalSettings is never read. Only the private clone is used.
Per run The captured delegate is reused by a fresh Core-owned transformer per run. No run clones the configuration or recompiles the root pair.
Nested pairs A nested or MapToTarget pair may compile lazily on its first mapping against the private clone. That bounded lazy compilation is part of the contract. Configuration added after composition does not recompile or change the captured root delegate.
Isolation ceiling Clone() isolates the configuration containers and recursively clones supported IApplyable values. Ordinary objects, delegates, closures, and custom mutable values stay shared references. Callers must not mutate them while composition or transform execution is active.
Failures Mapping exceptions propagate to Core unchanged. This package does not translate them into permanent stage failures, does not catch InvalidOperationException heuristically, and does not hide cleanup errors. Core owns result and error classification.
Cancellation The synchronous Mapster mapper has no mid-call cancellation point. Cancellation is checked immediately before invoking it and again after it returns, so a cancelled run never reports a successful mapping.
Logging The package logs nothing: no payloads, exception messages, configuration, or identifiers. It takes no logging dependency.

Trimming and NativeAOT

The package makes no blanket trimming or NativeAOT claim. Every runtime mapping entry point carries RequiresUnreferencedCode and RequiresDynamicCode, because Mapster builds expression trees and compiles them at runtime. Two measured facts define the boundary: a trimmed publish reports the aggregate IL2104 for the Mapster and Mapster.Core assemblies, and executing composition under TrimMode=link fails inside Mapster.TypeAdapterConfig.GetMapFunction. Consumers that need trimming or NativeAOT therefore use a hand-written or source-generated mapper through Core's PipelineTransformer.FromFunc instead; the mapster-trim-diagnostic consumer publishes and runs that route under TrimMode=link.

Usage

In the example below, sourceComponent is an existing PipelineComponent<IPipelineSource<Order>> supplied by the application.

var definition = PipelineDefinitionBuilder
    .From(new PipelineKey("orders"), sourceComponent)
    .MapWithMapster<Order, OrderDto>(
        new PipelineStageKey("map"),
        static config => config
            .NewConfig<Order, OrderDto>()
            .Map(destination => destination.Label, source => source.Name.ToUpperInvariant()))
    .Build();

await using var run = await definition.StartAsync();
await run.Completion;

Migrating from 2.1.2

SmartPipe.Extensions.Transforms.MapsterTransform<TInput,TOutput> moved into this package and stays reachable from SmartPipe.Extensions through type forwarding with its namespace, constructors, and behaviour unchanged. It keeps its shipped semantics, including its optional TypeAdapterConfig constructor and its Permanent "Mapster mapping error" stage failure. New code uses the composition API above, where the caller supplies a configuration callback instead of a mutable configuration instance and Core owns result classification.

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

Showing the top 1 NuGet packages that depend on SmartPipe.Extensions.Mapster:

Package Downloads
SmartPipe.Extensions

Compatibility facade and convenience bundle for SmartPipe.Core and its runtime integration packages. New applications should reference specific SmartPipe.Extensions.* packages. Retained 2.1.2 APIs use type forwarding or the frozen legacy DI/Hosting/Health cluster; removed HTTP/Polly APIs require migration and recompilation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 158 10/13/2026
2.2.0 970 10/7/2026

SmartPipe 2.2.1 servicing release; package compatibility is validated against 2.2.0. See https://github.com/MrFr3di/SmartPipe-Core/blob/main/CHANGELOG.md for release-wide changes and opt-in Core runtime APIs.