Basic date/time manipulation in NHiberate query
- by Yann Trevin
I'm trying to restrict my NHibernate query with some basic date/time manipulation. More specifically, I want to execute the following statement (pseudo-SQL):
select * from article where created_on + lifespan >= sysdate
with:
created_on is mapped to a property of type DateTime.
lifespan is mapped to a property of type TimeSpan.
sysdate is the current date/time (of the database server or ofthe application host, I don't care)
Is there any built-in way to do that by using the Criteria-API or HQL?
return session
.CreateCriteria<Article>()
.Add( ? )
.List<Article>();