You can execute raw SQL queries with EF code first with using the SqlQuery method:
var sql = "SELECT COUNT(*) FROM dbo.Articles WHERE (CategoryID = 3)";
var total = _context.Database.SqlQuery<int>(sql).First();
You can execute raw SQL queries with EF code first with using the SqlQuery method:
var sql = "SELECT COUNT(*) FROM dbo.Articles WHERE (CategoryID = 3)";
var total = _context.Database.SqlQuery<int>(sql).First();