0

I have problem while retrieving the records which are not older than 30 days. As today's date is 24 Jun, I would like to select records not beyond than 23rd May. That is I need all records for the days in between 23rd May and Today. For that The following query was being implemented

session.QueryOver<Property>().WhereRestrictionOn(x => x.DateUpdated).IsBetween(DateTime.Now).And(DateTime.Now.AddDays(-30)).List();

The Query was running with out any errors but the List was empty.

When seen through visual studio debugger it is saying that

session.QueryOver().WhereRestrictionOn(x => x.DateUpdated).IsBetween(DateTime.Now).And(DateTime.Now.AddDays(-30)).List() Expression cannot contain lambda expressions

I wrote the query as per the mock up seen from here.

navule
  • 3,212
  • 2
  • 36
  • 54

1 Answers1

1

try flipping the order of your 'between' clauses- IsBetween(DateTime.Now.AddDays(-30)).And(DateTime.Now)

J. Ed
  • 6,692
  • 4
  • 39
  • 55