How I can lookup a specific date in Nhibernate?
I'm currently using this to lookup one day's order.
ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order))
.Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1)))
.AddOrder(NHibernate.Criterion.Order.Desc("OrderID"));
I tried the following code, but they did bring the data for me.
Expression.Eq("DateCreated", date)
Expression.Like("DateCreated", date)
Note:
The pass in date value will be like this 2010-04-03 00:00:00
,
The actual date value in the database will be like this 2010-03-13 11:17:16.000
Can anyone let me know how to do this?
Many thanks.