使用SQL Server 2000进行Nhibernate 4.0.3分页

时间:2015-07-23 06:30:16

标签: nhibernate pagedlist

我为2000定制了一个方言。

public class MsSql2000Dialect : NHibernate.Dialect.MsSql2000Dialect
{
        public override bool SupportsLimit
        {
            get { return true; }
        }

        /// <summary>
        /// Does this Dialect support an offset?
        /// 
        /// </summary>
        public override bool SupportsLimitOffset
        {
            get
            {
                return true;
            }
        }

    }

但我发现它会生成愚蠢的查询。

select top [pageIndex]*pageSize from [table] ........

如何配置或编写代码,让查询为:

select top [pageSize] from [table] .... 
where .. 
  and Id not in(select top [paggeIndex]*pageSize Id from ............)

0 个答案:

没有答案