Trimming and Native AOT Limitations
Required package:
Dapper.FluentMap
Problem solved
Section titled “Problem solved”Use explicit or generated paths without claiming complete AOT support.
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 CustomerMap : EntityMap<Customer>{ public CustomerMap() { Map(x => x.Id).ToColumn("customer_id"); Map(x => x.Name).ToColumn("customer_name"); }}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.
Validated boundary
Section titled “Validated boundary”Ordinary runtime materialization may use reflection, expression compilation and Dapper fallback; it is not the certified Native AOT path. Generated materialization normally may also fall back. The validated Native AOT boundary is strict-generated SQLite with generated registration/materializers, explicit GeneratedParameters, safe column reordering/additions, property converters, nullable DateOnly/TimeOnly and deterministic rejection of unsupported shapes.
Dapper 2.1.89 suppresses selected IL diagnostics in upstream runtime fallback code. Suppression alone does not establish universal Native AOT compatibility for Dapper or FluentMap. Assembly scanning, convention-only discovery, arbitrary parameter objects, reflective TypeHandler interop and delegate construction strategies remain outside the strict-generated claim.