Hi,
I am in big need of help.
I am making dynamic query using Criteria:
ICriteria query = session.CreateCriteria(typeof(Employee));
if (searchOptions.FirstName != null)
{
query.Add(Expression.Eq("FirstName", searchOptions.FirstName));
}
if (!searchOptions.LastName != null)
{
query.Add(Expression.Eq("LastName", searchOptions.LastName));
}
if (searchOptions.PhoneNumber != null)
{
query.CreateCriteria("PhoneNumbers")
.Add(Expression.Like("Number", searchOptions.PhoneNumber + "%"));
}
After this I need to have both Total Row Count and Pagination.
For pagination:
query.SetFirstResult(0).SetMaxResults(8);
for rowcount:
query.SetProjection(Projections.RowCountInt64());
How can I execute both in a single query either by using a MultiCriteria or something else.
Please help!