Skip to content

PostgreSQL Example

Required packages: Dapper.FluentMap, Npgsql

Apply FluentMap above an Npgsql connection and explicit SQL aliases.

Use this capability when the column shape and .NET model should remain separated by explicit, reviewable configuration.

await using var connection = new NpgsqlConnection(connectionString);
var rows = connection.Query<Customer>(
"SELECT customer_id, customer_name FROM customers");

FluentMap registers typed metadata and applies it through the matching materialization path. SQL, connections, parameters, and lifecycle remain responsibilities of the application and Dapper.