Is it possible to generate SQL queries by ORM that use NOW function from database? For example:
select * from Order where OrderDate > Now() - Interval 1 Day
insert into Orders Set OrderDate = Now()
I am primarily interested in NHibernate and Entity Framework
You can not use example queries for dialect-specific functions because the properties will not match the desired types (if
OrderDateis aDateTimethere is no way to specifyNow() - Interval 1 Dayas aDateTime).If you have the dialect-specific functions defined (I believe you can use the techniques described at http://weblogs.asp.net/ricardoperes/archive/2011/06/14/adding-custom-sql-functions-to-nhibernate-at-runtime.aspx) you may be able to use Criteria queries.