Created
June 15, 2013 11:06
-
-
Save wullemsb/5787767 to your computer and use it in GitHub Desktop.
Linq to Entities: apply date transformations
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
var chartData = from log in _contextProvider.Context.Logs | |
group log by new | |
{ | |
ApplicationName=log.Application.Name, | |
Year= SqlFunctions.DatePart("Year", log.Timestamp), | |
Month= SqlFunctions.DatePart("Month",log.Timestamp) | |
} | |
into logsPerApplication | |
select new | |
{ | |
Count = logsPerApplication.Count(), | |
logsPerApplication.Key.ApplicationName, | |
logsPerApplication.Key.Year, | |
logsPerApplication.Key.Month | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment