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.
;
|