In dapper you can do something like:
var items = connection.Query<Items>("SELECT * FROM `@database`.`table` WHERE `id` IN @idList;", new {database = DatabaseName, idList = someList.Select(n => n.id)});
trying to do the same in ormlite:
var items = connection.Query<Items>("SELECT * FROM {0}`.`table` WHERE `id` IN {1};", DatabaseName, someList.Select(n => n.id)});
returns an error. Dapper creates the query as such:
SELECT * FROM `someDB`.`table` WHERE `id` IN (1,2,3,4);
where ormlite generates:
SELECT * FROM `someDB`.`table` WHERE `id` IN [1,2,3,4];
The square brackets aren't valid in MySQL. Is it possible to do this in ormlite?
When I try using the anonymous class to list parameters, as in the dapper example, it can't find the second parameter.
IN (@idList0, @idList1, @idList2)
... just sayin' ;) But this sounds like a question for @Mythz... – Goggin