--
Jan
___________________
j...@limpens.com
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339
Good question, I wonder it, too:)On Thu, Apr 3, 2008 at 11:15 PM, Jan Limpens <jan.l...@gmail.com> wrote:
Is there a reason why DetachedCriteria does not implement ICriteria?
I did not try out yet, whether the ICriteria returned
DetachedCriteria.GetExecutableCriteria(session) would allow me to alter
the original DetachedCriteria. That would suffice for my (current)
requirements. Anyways, if not so, a finer grained interface would help
me avoid redundancies in my code.
I'd personally would leave ICriteria as it is and provide a
ISetupCriteria for the current ICriteriaMethods minus List() and let
ICriteria inherit from it. But I am without good access to the sources
and have no idea if this would be possible.
Jan
so leave .List() from ICriteria, and put it on IExecutableCriteria.
"He" being me, Jan (?):
I have a MultiCriteria of related criterias.
I return a set of products, that match a certain tree of criteria,
then a count of all products that match these criteria, then the
categories of the products, that match this criteria, then the
priceranges of all products that match this criteria and so on...
So all these criteria depend on a certain base criteria set to be
consistent. Sometimes I need create this tree for a ICriteria,
sometimes for a DetachedCreteria, so I have a
private static ICriteria getBaseProductsCriteria(int groupId, int
categoryId, PriceRange range, ICriteria criteria)
and a
private static DetachedCriteria getBaseProductsCriteria(int groupId,
int categoryId, PriceRange range, DetachedCriteria criteria)
the second being a real 1:1 copy of the first.
So I asked myself, why DetachedCriteria did not implement ICriteria
and got good reasons back.
What is a future? Did I say something offending I should not have?
the second being a real 1:1 copy of the first.
So I asked myself, why DetachedCriteria did not implement ICriteria
and got good reasons back.
What is a future? Did I say something offending I should not have?
Take a look here:
http://code.google.com/p/unhaddins/wiki/LesTroisMousquetaires
Olá Fabio,
I use these DeachedCriteria for In subqueries as I cannot do joins on
monodirectional relations with criteria. With hql this is possible,
with criteria I was not able to use joins in such situations.
I need to construct the query on runtime, so I preferred the Criteria
approach. The Dao is exposed to the controllers by a NHibernate
agnostic interface, but that has not been a problem for me so far.
Yep, I've used this technique too with success in the past...
--
Regards,
Luis Abreu
email: labreu_at_gmail.com
PT Blog: http://weblogs.pontonetpt.com/luisabreu
EN Blog:http://msmvps.com/blogs/luisabreu/default.aspx
http://www.pontonetpt.com
MVP profile: http://mvp.support.microsoft.com/profile/luis.abreu
I use these DeachedCriteria for In subqueries as I cannot do joins on
monodirectional relations with criteria. With hql this is possible,
with criteria I was not able to use joins in such situations.
I need to construct the query on runtime, so I preferred the Criteria
approach. The Dao is exposed to the controllers by a NHibernate
agnostic interface, but that has not been a problem for me so far.
it's not exposed, but used only inside the dao