Answers
- We can add the following highlighted lines of code to read the order and its details from the results:
using (var connection = new SqlConnection(_connectionString)) { connection.Open(); using (GridReader results = connection.QueryMultiple( @"EXEC dbo.Order_GetHeader @OrderId = @OrderId; EXEC dbo.OrderDetails_Get_ByOrderId @OrderId = @OrderId", new { OrderId = orderId })) { var order = results.Read< OrderGetSingleResponse>().FirstOrDefault(); if (order != null) { order.Details = results.Read< OrderDetailGetResponse>().ToList(); } return order; } }
- The trade-off of using Dapper's...