Skip to the content.

Your type has multiple constructors. Vanilla Dapper would be happy to pick one based on the exact columns, but Dapper.AOT wants a single constructor to use with all data. You might consider marking your preferred constructor with [ExplicitConstructor]. This should probably be the one with the most parameters.

Bad:

class MyType
{
    public MyType(int id, string name) { }

    public MyType(DateTime when, int id, string name) { }
}

Good:

class MyType
{
    public MyType(int id, string name) { }

    [ExplicitConstructor]
    public MyType(DateTime when, int id, string name) { }
}

Note that parameters not found in the result grid will be assigned the default value for the parameter type (null, 0, false, etc).