-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Criteria Parser
PostPosted: Tue Sep 19, 2006 8:24 am 
Newbie

Joined: Tue Sep 19, 2006 8:09 am
Posts: 1
I Create a parser for Criteria. My program retrieve ICriterion instances and add them to CreateCriteria(...) collection.


Example : for a Criterion : ICriterion.AndExpression(Expression.Eq("Product.Dimension.Name", "blabla"), ExpressionEq("Product.Name", "aaaa"));

my program create :
ICriteria __crit = _session.CreateCriteria(typeof(T));
// NHibernate retrieve a root and build criteria from root child.
__crit.CreateCriteria("Product").Add( ExpressionEq("Name", "aaaa"));
__crit.CreateCriteria("Product").CreateCriteria("Dimension")Add( ExpressionEq("Name", "blabla"));

My parser work only with add criteria. I can only added a criteria.
I want extends my parser to "OR"
I dream a code type :
_session.CreateCriteria(typeof(T)).Add(Expression.Or(__crit.CreateCriteria("Product").Add( ExpressionEq("Name", "aaaa")),
(__crit.CreateCriteria("Product").CreateCriteria("Dimension")Add( ExpressionEq("Name", "blabla")))

but this code doesn't work. " Impossible cast ICriterion into Criteria".
My expressionEQ into ExpressionOR have a differents depths.


Thanks.




;


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.