[b]NHibernate version: 1.0.2.0 [/b]
[b]NHibernate Runtime version: 1.1.4322 [/b]
Hi,
I have an ICriterion array defined like this:
[code]ICriterion[] criteria;
criteria = new ICriterion[] { Expression.Or(Expression.Like("UsuarioId", "%" + pPatron + "%"), Expression.Or(Expression.Like("Nombre", "%" + pPatron + "%"), Expression.Like("Descripcion", "%" + pPatron + "%"))) };[/code]
And now I'm trying to find out how many records this criteria is going to get from the database (for paging purposes), so I'm building a query string like this:
[code]string query = "select count(*) from ...";
IQuery q = session.CreateQuery(query);
total = (int)q.UniqueResult();[/code]
My problem is that when I loop through the ICriterion array and invoke the ToString() function, it's returning the parameter values without quotes; and when I execute the code above, I get a syntax error.
Is there anyway to force NHibernate to use quotes when returning the ICriterion as a string?
Am I doing something wrong? or Does anyone know a better way to do what I'm trying?
Thanks in advance for your help !!!
|