Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
string sql = $@"SELECT [Id], [Title] FROM [Tracks] WHERE [Tracks].[Id] = 1;
SELECT [Id], [FirstName], [LastName] FROM [Drivers] WHERE [Id] IN (SELECT [DriverId] FROM [TrackWinners] WHERE [TrackWinners].[TrackId] = 1)";
using (var reader = await connection.QueryMultipleAsync(sql))
{
var track = reader.Read<Track>().FirstOrDefault();
if (track != null)
{
track.Winners = reader.Read<Driver>().ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment