Created
April 1, 2016 14:08
-
-
Save margusmartsepp/ef20aba06a8b49462c21b5eeb32ef34d to your computer and use it in GitHub Desktop.
ef7 code first + dapper
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
private static void Main(string[] args) | |
{ | |
var connection = new SqlConnection(@"Server=(local);Database=EF7.ConsoleTests;Trusted_Connection=True;"); | |
foreach (var result in connection.Query<Result>(@" | |
SELECT NAME as Name, | |
Count(NAME) AS Number | |
FROM [EF7.ConsoleTests].[dbo].[multiple] as k | |
GROUP BY NAME | |
ORDER BY Name, Number")) | |
{ | |
Console.WriteLine($"{result.Name} {result.Number}"); | |
} | |
} | |
public class Result | |
{ | |
public string Name { get; set; } | |
public int Number { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment