Immutable Domain Model
Required package:
Dapper.FluentMap
Problem solved
Section titled “Problem solved”Materialize a constructor-based aggregate with mapped columns.
When to use it
Section titled “When to use it”Use this capability when the column shape and .NET model should remain separated by explicit, reviewable configuration.
Example
Section titled “Example”public sealed class Customer{ public Customer(int id, string name) { Id = id; Name = name; }
public int Id { get; } public string Name { get; }}
var customer = connection.QueryMappedSingle<Customer>(sql);How it works
Section titled “How it works”FluentMap registers typed metadata and applies it through the matching materialization path. SQL, connections, parameters, and lifecycle remain responsibilities of the application and Dapper.