In order to use the OrderBy
clause on a DateTime
field ignoring the year I suggest you to base your query on the following code snippet which is retrieving data from the Orders table of the Northwind database.
(YourContextName db =
var orderByDateTimeWithoutYear = db.Orders
.Where(x => x.OrderDate.HasValue)
.OrderBy(x => x.OrderDate.Value.Month)
.ThenBy(x => x.OrderDate.Value.Day);
If you want to become more familiar with the LINQ capabilities of OpenAccess ORM you can download our SDK
and look at our Linq 101 sample.
I hope this helps.
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.