TwoRivers.Data.Dapper
2.0.0-beta.1
See the version list below for details.
dotnet add package TwoRivers.Data.Dapper --version 2.0.0-beta.1
NuGet\Install-Package TwoRivers.Data.Dapper -Version 2.0.0-beta.1
<PackageReference Include="TwoRivers.Data.Dapper" Version="2.0.0-beta.1" />
<PackageVersion Include="TwoRivers.Data.Dapper" Version="2.0.0-beta.1" />
<PackageReference Include="TwoRivers.Data.Dapper" />
paket add TwoRivers.Data.Dapper --version 2.0.0-beta.1
#r "nuget: TwoRivers.Data.Dapper, 2.0.0-beta.1"
#:package TwoRivers.Data.Dapper@2.0.0-beta.1
#addin nuget:?package=TwoRivers.Data.Dapper&version=2.0.0-beta.1&prerelease
#tool nuget:?package=TwoRivers.Data.Dapper&version=2.0.0-beta.1&prerelease
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 | Versions 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. |
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 |