Date range query in Entity framework



Entity Framework Date rang query is not same as like LINQ.
You can try like this


 var events = this.coreDomainContext.Events.Where(  
   e => EntityFunctions.TruncateTime(e.EventDate.Value) >= DateTime.Today  
    && EntityFunctions.TruncateTime(e.EventDate.Value) <= EntityFunctions.TruncateTime(endPeriod))  
   .OrderByDescending(e => e.EventDate)  
   .ToList();  

For details you can See

Popular posts from this blog

WPF Crystal Report Viewer Using SAP

mvc razor textboxfor change event change another textboxfor value

ASP.NET MVC razor SAP Crystal report