I use EF 4 and c#, MS SQL 2008.
I have a T-SQL:
select COUNT(*)
from CmsContents
where IsPublished = 1 and isDeleted = 0
GROUP BY Day(Date)
I need convert it to EF, but I’m not able to get it.
Here what I’m using:
var contentsByMonth = context.CmsContents
.Where(c => c.IsPublished == true & c.IsDeleted == false)
.GroupBy(c => c.Date.Month).ToList().Count();
Could you give me an example? Thanks
1 Answer