Property Converters
Required package:
Dapper.FluentMap
Problem solved
Section titled “Problem solved”Convert database values before assigning them to mapped properties.
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”Map(x => x.Status) .ToColumn("status_code") .ConvertFromDatabaseUsing<ProductStatusConverter, string>();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.
Provider-specific date/time values
Section titled “Provider-specific date/time values”Property converters run before Dapper type handlers and FluentMap default conversion. They are the verified solution when a provider exposes date/time data in another CLR representation, such as SQLite ISO text:
Map(x => x.BusinessDate) .ToColumn("business_date") .ConvertFromDatabaseUsing<string, DateOnly>(value => DateOnly.ParseExact(value, "yyyy-MM-dd", CultureInfo.InvariantCulture));Database NULL remains null for nullable targets and does not invoke the converter.