Skip to the content.

To handle parameters efficiently, Dapper.AOT first needs to understand what you’re doing. If your parameter data is object, dynamic etc, then we can’t do that at compile-time, so: Dapper.AOT can’t help.

Either used typed parameters, or disable Dapper.AOT ([DapperAot(false)]).

If you’re using DynamicParameters, note that this is often wildly overused. If your usage looks like

var args = new DynamicParameters();
args.Add("id", 42);
args.Add("name", "Fred");
conn.Execute("somesql", args);

then you can make this much more efficient (and Dapper.AOT-friendly) with simply:

conn.Execute("somesql", new { id = 42, name = "Fred" });

If you’re using DynamicParameters for things like output-parameters, Dapper.AOT has new options for that; you can use [DbValue(Direction = ...)] on properties of a custom type.