本文整理汇总了C#中ICriteriaQuery.CreatePagingParameter方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.CreatePagingParameter方法的具体用法?C# ICriteriaQuery.CreatePagingParameter怎么用?C# ICriteriaQuery.CreatePagingParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteriaQuery
的用法示例。
在下文中一共展示了ICriteriaQuery.CreatePagingParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
InitializeInnerQueryAndParameters(criteriaQuery);
if (innerQuery.HasProjection == false)
{
throw new QueryException("Cannot use subqueries on a criteria without a projection.");
}
ISessionFactoryImplementor factory = criteriaQuery.Factory;
IOuterJoinLoadable persister = (IOuterJoinLoadable)factory.GetEntityPersister(criteriaImpl.EntityOrClassName);
//buffer needs to be before CriteriaJoinWalker for sake of parameter order
SqlStringBuilder buf = new SqlStringBuilder().Add(ToLeftSqlString(criteria, criteriaQuery));
//patch to generate joins on subqueries
//stolen from CriteriaLoader
CriteriaJoinWalker walker =
new CriteriaJoinWalker(persister, innerQuery, factory, criteriaImpl, criteriaImpl.EntityOrClassName, enabledFilters);
SqlString sql = walker.SqlString;
if (criteriaImpl.FirstResult != 0 || criteriaImpl.MaxResults != RowSelection.NoValue)
{
int firstResults = Loader.Loader.GetFirstRow(parameters.RowSelection);
int maxResults = Loader.Loader.GetMaxOrLimit(factory.Dialect, parameters.RowSelection);
int? offsetParameterIndex = criteriaQuery.CreatePagingParameter(firstResults);
int? limitParameterIndex = criteriaQuery.CreatePagingParameter(maxResults);
sql = factory.Dialect.GetLimitString(sql, firstResults, maxResults, offsetParameterIndex, limitParameterIndex);
}
if (op != null)
{
buf.Add(" ").Add(op).Add(" ");
}
if (quantifier != null && prefixOp)
{
buf.Add(quantifier).Add(" ");
}
buf.Add("(").Add(sql).Add(")");
if (quantifier != null && prefixOp == false)
{
buf.Add(" ").Add(quantifier);
}
return buf.ToSqlString();
}