Dapper.FluentMap A Getting Started Tutorial for Mapping
Overview
Dapper.FluentMap is a small library that allows you to fluently map properties of your domain classes to the database columns. This library functionality is similar to Entity Framework Fluent API and keeps your domain classes clean of mapping attributes.
- It is straightforward to set up; just create a map class for each of your domain model and database model classes, and configure the mappings using the fluent API.
- Once configured, FluentMap lets Dapper map database result columns to properties on your domain classes.
- By default, Dapper will map an object's properties to columns with the same name.
- However, sometimes you might want to map an object's properties to columns with different names.
- It allows you to configure these mappings in a fluent, concise way.
Project Status
Dapper.FluentMap is actively maintained. The original repository, created by Henk Mollema, has moved to rodri-oliveira-dev/Dapper-FluentMap. The maintained 3.x release line continues the core mapping APIs while introducing optional capabilities. Version 3.6.0 was published on October 13, 2026; check GitHub Releases for the latest version.
NuGet Installation
Dapper.FluentMap is available through NuGet: https://www.nuget.org/packages/Dapper.FluentMap/
You can easily install this library by running the following command:
PM> Install-Package Dapper.FluentMap
APIs
There are two types of mapping supported in Dapper.FluentMap.
- Manual mapping
- Convention-based mapping
You can map property names manually using the EntityMap<TEntity> class.
public class InvoiceMap : EntityMap<Invoice> { public InvoiceMap() { // Map property 'InvoiceID' to column 'Id'. Map(i => i.InvoiceID).ToColumn("Id"); // Ignore the 'Detail' and 'Items' properties when mapping. Map(i => i.Detail).Ignore(); Map(i => i.Items).Ignore(); } }
Initialize your mapping at the start of your application. The existing EntityMap<TEntity> and FluentMapper.Initialize(...) APIs remain supported in the 3.x line.
FluentMapper.Initialize(config =>
{
config.AddMap(new InvoiceMap());
});
Documentation
The maintained project provides the following documentation:
- README and getting started
- Usage examples
- Migration guide from 2.x to 3.x
- Compatibility and supported environments
The 3.x line also adds opt-in features such as mapping profiles, immutable-object materialization, isolated runtimes, and optional dependency-injection, Roslyn analyzer, and source-generator packages. Refer to the project documentation for their supported scenarios and limitations.
Support
For questions, bug reports, and feature requests, use the current GitHub Issues page. For version-specific changes, see GitHub Releases. Support is community-maintained; response times are not guaranteed.
ZZZ Projects