我试图比较nHibernate linq中的两个日期(DateTime):

query = query.Where(l => (l.datCriacao.Date == dtLote.Date)

但是我得到了错误:
NHibernate.QueryException: could not resolve property: datCriacao.Date of: SAGP.Entities.Lote

有人知道我该如何解决?谢谢

最佳答案

我解决了日期之间的问题:

DateTime initialDate, finalDate;
initialDate= DateEntity.Date;
finalDate= new DateTime(DateEntity.Year, DateEntity.Month, DateEntity.Day, 23, 59, 59);
query = query.Where(l => (((l.dateEntity>= initialDate) && (l.dateEntity<= finalDate))

10-07 13:36