I would like to fetch all records from particular day, no matter what time is associated with those records. So far I have method like this:
public IQueryabl
As said in the comments, your LINQ query works fine with NH 3.3.
In earlier releases, you can use HQL:
return session.CreateQuery("from MyClass where date(MyDate) = :day")
.SetParameter("day", day.Date)
.List(); //executes
You can also use the date
function from Criteria, via SqlFunction. This is more convoluted, but allows building more dynamic queries:
return session.CreateCriteria()
.Add(Restrictions.Eq(
Projections.SqlFunction("date",
NHibernateUtil.Date,
Projections.Property("MyDate")),
day.Date))
.List(); //executes