views:

33

answers:

0

Here what I would like to do:

var groups = 
  from g in Group.All() 
  where g.FirstDay < startDate && (g.LastDay == null || g.LastDay >= startDate)
  select g;

FirstDate is a dateTime and LastDate is a nullable datetime. I'm getting an "System.InvalidOperationException: The operators of the 'LessThan' do not correspond with parameters from the method 'op_LessThan'."

This query works with small modifications (and completely different results!) like:

var groups = 
  from g in Group.All() 
  where g.LastDay == null && g.FirstDay < startDate 
  select g;

var groups = 
  from g in Group.All() 
  where (g.LastDay >= startDate || g.LastDay == null)
  select g;

I already changed the order of the expressions, but it do not change the results...

Any ideas?!

Thanks!!! I am getting crazy with this small query!