I am using Entity Framework in an MVC website
I am trying to get just the number of records using a raw query.
I am looking for something along these lines but any will be happy with any solution at all.
var sql = SELECT COUNT(*) FROM dbo.Articles WHERE (CategoryID = 3)
var total = _context.Database.SOMETHING(sql)
I realise that for such a simple scenario, a raw query is perhaps not the way to go but in reality, the sql string is MUCH more complicated so it is next to impossible for to use Linq to SQL.
_context
?DbContext
,DataContext
,ObjectContext
?