Created
May 29, 2019 04:33
-
-
Save mikependon/1bea040ad54744ad88d76fcad8bd2d61 to your computer and use it in GitHub Desktop.
IDbConnection (QueryMultiple<Customer, Order>)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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