How to map multiple records from a single SP with Dapper-dot-net

半腔热情 提交于 2019-11-30 12:45:14

This one is from the home page, but there should be similar in the tests:

var sql = @"...";
using (var multi = connection.QueryMultiple(sql, new {id=selectedId}))
{
   var customer = multi.Read<Customer>().Single();
   var orders = multi.Read<Order>().ToList();
   var returns = multi.Read<Return>().ToList();
   ...
} 

Arguments etc work as normal, and should map directly to defined parameter names if CommandType is specified.

Each call to .Read<T>() relates to a successive results grid.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!