Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does dapper support .net dataset

Tags:

dapper

in my opinion for dapper.query object there is a datareader, for dapper.Execute there is a ExectureNonQuery object. Correct me if i am wrong .

Can we use dapper for dataset which returns multiple tables?

like image 992
user2688063 Avatar asked Aug 19 '13 15:08

user2688063


1 Answers

No, there is not any built in support for DataSet, primarily because it seems largely redundant, but also because that isn't what dapper targets. But that doesn't mean it doesn't include an API for handling a query that selects multiple results; see QueryMultiple:

using (var multi = conn.QueryMultiple(sql, args))
{
    var ids = multi.Read<int>().ToList();
    var customers = multi.Read<Customer>().ToList();
    dynamic someOtherRow = multi.Read().Single();
    int qty = someOtherRow.Quantity, price = someOtherRow.Price;
}

Note that this API is forwards only (due to the nature of IDataReader etc) - basically, each Read / Read<T> etc maps to the next result grid in turn.

like image 149
Marc Gravell Avatar answered Jan 04 '23 05:01

Marc Gravell