views:

589

answers:

2

Hello, I trying to compare two dates (DateTime) in nhibernate linq: query = query.Where(l => (l.datCriacao.Date == dtLote.Date)

but the error: NHibernate.QueryException: could not resolve property: datCriacao.Date of: SAGP.Entities.Lote

anyone knows how I can solve this?

tks

A: 

You cant do it via current version of linq to hibernate. it is made based on Criteria API.

Sly
and how I can do it? only with hql?
jaspion
Yes, hql probably
Sly
2 current versions exist
Paco
I mean current released versions...
Sly
+3  A: 

I solved the problem doing a between with the dates:

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))
jaspion