Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikependon/1bea040ad54744ad88d76fcad8bd2d61 to your computer and use it in GitHub Desktop.
Save mikependon/1bea040ad54744ad88d76fcad8bd2d61 to your computer and use it in GitHub Desktop.
IDbConnection (QueryMultiple<Customer, Order>)
using (var connection = new SqlConnection(connectionString))
{
// Call the method, returns Tuple<T1, T2>
var tuple = connection.QueryMultiple<Customer, Order>(c => c.Id == customerId, o => o.CustomerId = customerId);
// Get each item from the Tuple
var customer = tuple.Item1.FirstOrDefault();
var orders = tuple.Item2.ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment