When using SQLite with DapperAOT and passing a list of values into an IN clause, the following query fails in AOT mode:
public Task<int> RemoveRangeAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken)
{
const string sql = "DELETE FROM Users WHERE Id IN @Ids";
return db.ExecuteAsync(sql, new { Ids = ids.Select(s => s.ToString()) }, transaction: tx);
}
Error:
SQLite Error 1: 'near "@Ids": syntax error'
However, if I disable source generation for this method using [Dapper(false)], it works as expected.
[DapperAot(false)]
public Task<int> RemoveRangeAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken) { ... }
It seems like the AOT generator does not correctly expand or transform the parameter list in the IN clause for SQLite. This syntax works fine with classic Dapper (non-AOT) and also in other database engines (like SQL Server).
Environment:
- Database: SQLite
- DapperAOT version: 1.0.48
- .NET version: 9
When using SQLite with DapperAOT and passing a list of values into an IN clause, the following query fails in AOT mode:
Error:
SQLite Error 1: 'near "@Ids": syntax error'However, if I disable source generation for this method using [Dapper(false)], it works as expected.
It seems like the AOT generator does not correctly expand or transform the parameter list in the IN clause for SQLite. This syntax works fine with classic Dapper (non-AOT) and also in other database engines (like SQL Server).
Environment: