TinyHelpers.Dapper 3.2.40

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

Tiny Helpers for Dapper

Lint Code Base CodeQL NuGet NuGet License: MIT

TinyHelpers.Dapper is a small collection of practical Dapper type handlers for .NET applications.

The package helps reduce repetitive mapping code when your database stores values as JSON, delimited strings, or date/time-specific types.

Compatibility

The package targets:

  • .NET Standard 2.0
  • .NET 8
  • .NET 9
  • .NET 10

Notes:

  • DateOnlyTypeHandler and TimeOnlyTypeHandler are available only on .NET 6+ targets, so they are not compiled for .NET Standard 2.0.
  • JsonTypeHandler<T> can be used with any CLR type that Dapper maps to and from JSON columns.

Installation

Install from NuGet by searching for TinyHelpers.Dapper in Visual Studio Package Manager or using the .NET CLI:

dotnet add package TinyHelpers.Dapper

Contents

Type handlers

JsonTypeHandler<T>

Reads and writes a CLR type as JSON.

Use it when you want to store a complex object graph in a single column and keep serializer configuration centralized instead of repeating it in each query or repository.

StringArrayTypeHandler

Converts string[] values to a single delimited string.

Use it when a database column stores a small set of string values and you want to work with arrays in your application code.

StringEnumerableTypeHandler

Converts IEnumerable<string> values to a single delimited string.

Use it when you want the consuming code to stay sequence-oriented while still persisting a simple delimited representation.

DateOnlyTypeHandler

Maps DateOnly values to a database date column.

Use it when you want to persist calendar dates without introducing an artificial time component.

TimeOnlyTypeHandler

Maps TimeOnly values to a database time column.

Use it when you want to persist a time of day without tying it to a date.

TimeSpanTypeHandler

Maps TimeSpan values using ticks.

Use it when you want a stable, culture-independent representation for durations.

Usage

Register the handlers at application startup by calling their Configure methods.

JSON mapping

using System.Text.Json;
using TinyHelpers.Dapper.TypeHandlers;

JsonTypeHandler<Person>.Configure(
    new JsonSerializerOptions(JsonSerializerDefaults.Web),
    useUtcDate: true,
    serializeEnumAsString: true);

String collection mapping

using TinyHelpers.Dapper.TypeHandlers;

StringArrayTypeHandler.Configure(",");
StringEnumerableTypeHandler.Configure(",");

Date and time mapping

using TinyHelpers.Dapper.TypeHandlers;

TimeSpanTypeHandler.Configure();

DateOnlyTypeHandler.Configure();
TimeOnlyTypeHandler.Configure();

Quick examples

JSON-backed property mapping

using System.Text.Json;
using TinyHelpers.Dapper.TypeHandlers;

JsonTypeHandler<Metadata>.Configure(
    new JsonSerializerOptions(JsonSerializerDefaults.Web),
    useUtcDate: true,
    serializeEnumAsString: true);

var post = await connection.QuerySingleAsync<Post>(
    "select Id, Metadata from Posts where Id = @Id",
    new { Id = 1 });

String collection mapping

using TinyHelpers.Dapper.TypeHandlers;

StringArrayTypeHandler.Configure(",");

var post = await connection.QuerySingleAsync<Post>(
    "select Id, Tags from Posts where Id = @Id",
    new { Id = 1 });

Date and time mapping

using TinyHelpers.Dapper.TypeHandlers;

DateOnlyTypeHandler.Configure();
TimeOnlyTypeHandler.Configure();
TimeSpanTypeHandler.Configure();

var schedule = await connection.QuerySingleAsync<Schedule>(
    "select StartDate, StartTime, Duration from Schedules where Id = @Id",
    new { Id = 1 });

Contribute

The project is continuously evolving. Contributions, issues, and pull requests are welcome.

Work on the develop branch, not on master. Pull requests should target develop.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
3.2.40 31 6/10/2026
3.2.37 108 5/22/2026
3.2.36 127 4/15/2026
3.2.34 152 3/11/2026
3.2.33 131 2/11/2026
3.2.31 139 1/14/2026
3.2.30 489 12/10/2025
3.2.29 337 11/13/2025
3.2.27 247 10/15/2025
3.2.25 374 9/10/2025
3.2.23 261 9/1/2025
3.2.21 223 7/30/2025
3.2.20 252 7/9/2025
3.2.18 431 6/11/2025
3.2.17 350 5/14/2025
3.2.16 298 4/9/2025
3.2.15 278 3/18/2025
3.2.14 292 3/12/2025
3.2.13 233 2/28/2025
3.2.12 255 2/13/2025
Loading failed