I guess it is a bit long
Restrictions.GeProperty(Projections.SqlFunction("DateDiff",NHibernateUtil.Boolean,
Projections.Constant("hh"),
Projections.Property("LastUploaded"),
Projections.SqlFunction("GetDate",NHibernateUtil.Date)),"UploadFrequencyInHours")
I am not sure about the "hh" part, if it doesnt work use Projections.Sql and
see if it works.
Tuna Toksöz
http://tunatoksoz.com
http://turkiyealt.net
http://twitter.com/tehlike
Typos included to enhance the readers attention!
On Mon, Mar 2, 2009 at 3:25 PM, Tuna Toksoz <[email protected]> wrote:
> You can use SqlFunctionProjection together with GreaterThan.
> Is that clear?
>
> Tuna Toksöz
> http://tunatoksoz.com
> http://turkiyealt.net
> http://twitter.com/tehlike
>
> Typos included to enhance the readers attention!
>
>
>
>
> On Mon, Mar 2, 2009 at 3:05 PM, Colin Ramsay <[email protected]>wrote:
>
>>
>> Hi all,
>>
>> Given this data:
>>
>> Feed includedFeed = new Feed {
>> LastUploaded = DateTime.Now.AddHours(-6),
>> UploadFrequencyInHours = 5
>> };
>>
>> Feed excludedFeed = new Feed {
>> LastUploaded = DateTime.Now,
>> UploadFrequencyInHours = 5
>> };
>>
>> I would like to query the database using the criteria API to get
>> "pending feeds", ie. ones which have not been uploaded within the
>> UploadFrequencyInHours window. Something like this in SQL:
>>
>> WHERE (DateDiff(hh, LastUploaded, getdate()) >=
>> UploadFrequencyInHours)
>>
>> Is there a method of doing this with Criteria?
>>
>> Thanks,
>> Colin.
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---