I have a SQL Server Employee table with an EntryDate column defined as DATETIME .
I also have the following poco:
public class Employee { public int Id {get; set;} public DateTime EntryDate {get; set;} ... }
When I query the table using:
Db.Select<Employee>(e => e.EntryDate >= new DateTime(2014, 8, 15));
Or:
Db.Select<Employee>(q => q.Where(e => e.EntryDate >= new DateTime(2014, 8, 15)));
I get what I expect, however , when I try to run:
Db.Select<Employee>(e => e.EntryDate.Date >= new DateTime(2014, 8, 15).Date));
Or:
Db.Select<Employee>(q => q.Where(e => e.EntryDate.Date >= new DateTime(2014, 8, 15).Date));
I get:
variable 'e' of type "Employee" referenced by scope "', but this is not defined
Just for confirmation, writing raw SQL also works great.
Any ideas?
MaYaN source share