public static IQueryable <TEntity> Query <TEntity>(this IQueryable <TEntity> qry, ICriteria <TEntity> criteria) where TEntity : class { if (criteria == null) { return(qry); } qry = criteria.Apply(qry); return(qry); }