TwoRivers.Data.Dapper 2.0.0-beta.3

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

TwoRivers.Dapper

Provides column mapping for Dapper. This allows you to map column names to properties on your classes without having to jump through hoops.

Installation

You can install the TwoRivers.Data.Dapper package via Package Manager Console:

Install-Package TwoRivers.Data.Dapper

Or via .NET CLI:

dotnet add package TwoRivers.Data.Dapper

Usage

Decorate your class with the [HasColumnMaps] attribute and then decorate the properties with the [ColumnName] attribute to map the column name to the property.

[HasColumnMaps]
public class Invoice
{
    [ColumnName("id")]
    public Int32 InvoiceNumber { get; set; }

    public required InvoiceLineItem[] LineItems { get; set; } = [];

    [ColumnName("customer_fk")]
    public Int32 CustomerId { get; set; }

    [ColumnName("site_number")]
    public Int32 SiteNumber { get; set; }
}

Before your first query, use one or more of the following to apply the column maps:

ColumnMapper.MapTypesFromCallingAssembly();

ColumnMapper.MapTypesFromExecutingAssembly();

ColumnMapper.MapTypesFromAssemblyContaining<Invoice>();

ColumnMapper.MapTypesFromAssemblies(typeof(Invoice).Assembly);

Or map specific types:

ColumnMapper.Map<Invoice>();

typeof(Invoice).MapColumns();

NOTE: If you are mapping specific types, you do not need to apply the [HasColumnMaps] attribute to the class.

That's it! You are done! Dapper will now use the column mappings when a query returns a type that has been mapped.

License

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

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

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
2.0.0-beta.8 72 3/5/2026
2.0.0-beta.7 68 3/5/2026
2.0.0-beta.6 58 3/5/2026
2.0.0-beta.5 61 3/4/2026
2.0.0-beta.4 67 3/4/2026
2.0.0-beta.3 62 3/3/2026
2.0.0-beta.2 67 3/3/2026
2.0.0-beta.1 64 3/3/2026
2.0.0-beta.0 68 3/3/2026
1.1.6 120 2/26/2026
1.1.5 107 2/25/2026
1.1.4 109 2/22/2026
1.1.3 109 2/22/2026
1.1.2 108 2/22/2026
1.1.1 111 2/22/2026
1.1.0 112 2/22/2026
1.0.0 136 2/17/2026
Loading failed