Dapper to DataTable

c#, dapper

Solution

There will be no advantage whatsoever in using dapper for a scenario involving `DataSet`. And in particular, your specific example (without any parameters etc) is so trivial (not meant negatively - simply objectively) that you might as well use `ExecuteReader` directly, or use a `DbDataAdapter`

I am, however, open to exposing an API on dapper that exposes the `IDataReader` API from dapper - you could feed that to any consumer you want, `DataSet` / `DataTable` included. But I really must question: what would be the point in performing this example via dapper? It might make more sense if you were at least using dapper to handle parameters (I'm damned pleased with how the parameter handling worked out, truth be told).

Problem

I have a scenario where I need to return a `DataTable` from a query using Dapper. How do I return a `DataTable` from a query using Dapper? ``` DataTable dt = connection.Query("SELECT * FROM table"); ```

Original source

Related problems