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...