DKNet.Svc.Transformation 9.0.34

There is a newer version of this package available.
See the version list below for details.
dotnet add package DKNet.Svc.Transformation --version 9.0.34
                    
NuGet\Install-Package DKNet.Svc.Transformation -Version 9.0.34
                    
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="DKNet.Svc.Transformation" Version="9.0.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DKNet.Svc.Transformation" Version="9.0.34" />
                    
Directory.Packages.props
<PackageReference Include="DKNet.Svc.Transformation" />
                    
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 DKNet.Svc.Transformation --version 9.0.34
                    
#r "nuget: DKNet.Svc.Transformation, 9.0.34"
                    
#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 DKNet.Svc.Transformation@9.0.34
                    
#: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=DKNet.Svc.Transformation&version=9.0.34
                    
Install as a Cake Addin
#tool nuget:?package=DKNet.Svc.Transformation&version=9.0.34
                    
Install as a Cake Tool

DKNet.Svc.Transformation

A flexible .NET library for template-based data transformation, designed for APIs, DDD, and EF Core scenarios. Supports custom token extraction, dynamic value resolution, and is fully configurable via dependency injection.

Features

  • Transform template strings using data objects or custom token factories
  • Extensible token extractors for different template formats
  • Configurable value formatting and caching
  • Designed for dependency injection
  • .NET 9.0 compatible

Installation

Add the NuGet package to your project:

dotnet add package DKNet.Svc.Transformation

Usage

Register the service in your DI container:

using Microsoft.Extensions.DependencyInjection;
using DKNet.Svc.Transformation;

var services = new ServiceCollection();
services.AddTransformerService(options =>
{
    // Customize TransformOptions if needed
    options.DisabledLocalCache = false;
});

Transform a template string:

var transformer = services.BuildServiceProvider().GetRequiredService<ITransformerService>();

string template = "Hello [Name]. Your {Email} had been [ApprovedStatus]";
var result = await transformer.TransformAsync(template, new { Name = "Duy", Email = "drunkcoding@outlook.net", ApprovedStatus = "Approved" });
// result: "Hello Duy. Your drunkcoding@outlook.net had been Approved"

Or use a custom token factory:

var result = await transformer.TransformAsync(template, async token =>
{
    // Custom logic to resolve token value
    return await GetValueForTokenAsync(token);
});

API

  • ITransformerService.TransformAsync(string templateString, params object[] parameters): Transform using provided data objects.
  • ITransformerService.TransformAsync(string templateString, Func<IToken, Task<object>> tokenFactory): Transform using a custom token resolver.
  • TransformOptions: Configure extractors, formatters, caching, and global parameters.
  • TransformSetup.AddTransformerService(IServiceCollection, Action<TransformOptions>?): Register the service with DI.

License

MIT © 2026 drunkcoding

Repository

https://github.com/baoduy/DKNet

Contributing

Pull requests and issues are welcome!

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

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
9.0.38 38 9/24/2025
9.0.37 50 9/23/2025
9.0.36 56 9/23/2025
9.0.35 51 9/23/2025
9.0.34 58 9/23/2025
9.0.33 63 9/21/2025
9.0.32 74 9/21/2025
9.0.31 249 9/19/2025
9.0.30 262 9/18/2025
9.0.29 262 9/18/2025
9.0.28 256 9/17/2025
9.0.27 257 9/17/2025
9.0.26 263 9/16/2025
9.0.25 201 9/15/2025
9.0.24 202 9/15/2025
9.0.23 69 9/6/2025
9.0.22 143 9/3/2025
9.0.21 130 9/1/2025
9.0.20 145 7/15/2025
9.0.19 140 7/14/2025
9.0.18 144 7/14/2025
9.0.17 140 7/14/2025
9.0.16 118 7/11/2025
9.0.15 123 7/11/2025
9.0.14 125 7/11/2025
9.0.13 130 7/11/2025
9.0.12 149 7/8/2025
9.0.11 142 7/8/2025
9.0.10 137 7/7/2025
9.0.9 139 7/2/2025
9.0.8 144 7/2/2025
9.0.7 149 7/1/2025
9.0.5 143 6/24/2025
9.0.4 146 6/24/2025
9.0.3 142 6/23/2025
9.0.2 145 6/23/2025
9.0.1 149 6/23/2025