Castle / Active Entries: what do you think of the facilities?
I am trying to make a simple "Select Count (*) from PRODUCT, where date> xxx" from Castle to NHibernate.
If I were to use NHibernate directly, I could reuse this question , but unfortunately, I see no easy way to access the current NHibernate session from Castle entries.
I obviously do not want to retrieve all my objects and do the counting on the C # side;). I only need to know how many objects are there.
Any ideas?
There are many ways to do this, the simplest:
ActiveRecordMediator<Product>.Count(Expression.Gt("date", DateTime.Now)) or you can use CountQuery, HQL, etc., there are many alternatives.
UPDATE: for NHibernate 2.0 + it Restrictions instead of Expression .
I will copy common questions like these into the ActiveRecord wiki .