示例#1
0
        private TCollection InnerQuery(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            QueryCondition qc = new QueryCondition(startRowIndex,
                                                   maximumRows, "*", GetMappingInfo().TableName, orderBy, where);

            OnBuildQueryCondition(qc);

            TSqlCommonAdapter adapter = new TSqlCommonAdapter(GetConnectionName());

            TCollection result = adapter.SplitPageQuery <T, TCollection>(qc, this.OnDataRowToObject, ref totalCount);

            ObjectContextCache.Instance[ContextCacheKey] = totalCount;

            return(result);
        }
示例#2
0
        private DataView InnerQuery(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            QueryCondition qc = new QueryCondition(startRowIndex,
                                                   maximumRows, "*", this._DefaultTableName, orderBy, where);

            OnBuildQueryCondition(qc);

            TSqlCommonAdapter adapter = new TSqlCommonAdapter(GetConnectionName());

            DataView result = adapter.SplitPageQuery(qc, ref totalCount);

            ObjectContextCache.Instance[ContextCacheKey] = totalCount;

            return(result);
        }
        private PagedQueryResult <T, TCollection> InnerQuery(int startRowIndex, int maximumRows, int top, string select, string from, string where, string orderBy, int totalCount)
        {
            if (select.IsNullOrEmpty())
            {
                select = "*";
            }

            if (from.IsNullOrEmpty())
            {
                from = GetMappingInfo().GetQueryTableName();
            }

            QueryCondition qc = new QueryCondition(startRowIndex,
                                                   maximumRows, select, from, orderBy, where);

            qc.Top = top;

            OnBuildQueryCondition(qc);

            TSqlCommonAdapter adapter = new TSqlCommonAdapter(GetConnectionName());

            TCollection list = adapter.SplitPageQuery <T, TCollection>(qc, this.OnDataRowToObject, ref totalCount);

            ObjectContextCache.Instance[ContextCacheKey] = totalCount;

            PagedQueryResult <T, TCollection> result = new PagedQueryResult <T, TCollection>();

            if (maximumRows > 0)
            {
                result.PageIndex = (qc.RowIndex / maximumRows) + 1;
            }
            else
            {
                result.PageIndex = 1;
            }

            result.PageSize   = maximumRows;
            result.TotalCount = totalCount;
            result.PagedData  = list;

            return(result);
        }