Tags: , , | Categories: C#, LINQ, NHibernate Posted by Admin on 8/3/2011 7:49 AM | Comments (0)

We tried to write a filter based on a DateTime? (nullable DateTime) property like

IList<Vacancy> vacancies = manager.Get<Vacancy>(v => v.StartDate.GetValueOrDefault(DateTime.MinValue) < DateTime.Today);

But NHibernate (or possibly NHibernate.Linq) threw a runtime error. It turns out that NHibernate(.Linq) handles all this for us so

IList<Vacancy> vacancies = manager.Get<Vacancy>(v => v.StartDate < DateTime.Today);

Works perfectly!

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading