这是我在 dapper 博客中发现的
var sql =
@"
select * from Customers where CustomerId = @id
select * from Orders where CustomerId = @id
select * from Returns where CustomerId = @id";
using (var multi = connection.QueryMultiple(sql, new {id=selectedId}))
{
var customer = multi.Read<Customer>().Single();
var returns = multi.Read<Return>().ToList();
var orders = multi.Read<Order>().ToList();
...
}
我的要求是我想直接阅读 "orders" 。我可以这样做吗?