Ejemplo n.º 1
0
        /// <summary>Orders the query results by the specified criteria and skips a specified number of results.</summary>
        /// <returns>
        /// A new <see cref="T:System.Data.Entity.Core.Objects.ObjectQuery`1" /> instance that is equivalent to the original instance with both ORDER BY and SKIP applied.
        /// </returns>
        /// <param name="keys">The key columns by which to order the results.</param>
        /// <param name="count">The number of results to skip. This must be either a constant or a parameter reference.</param>
        /// <param name="parameters">An optional set of query parameters that should be in scope when parsing.</param>
        /// <exception cref="T:System.ArgumentNullException">Any argument is null.</exception>
        /// <exception cref="T:System.ArgumentException"> keys  is an empty string or count  is an empty string.</exception>
        public ObjectQuery <T> Skip(string keys, string count, params ObjectParameter[] parameters)
        {
            Check.NotEmpty(keys, "keys");
            Check.NotEmpty(count, "count");
            Check.NotNull(parameters, "parameters");

            return(new ObjectQuery <T>(EntitySqlQueryBuilder.Skip(QueryState, Name, keys, count, parameters)));
        }
 /// <summary>Orders the query results by the specified criteria and skips a specified number of results.</summary>
 /// <returns>
 /// A new <see cref="T:System.Data.Entity.Core.Objects.ObjectQuery`1" /> instance that is equivalent to the original instance with both ORDER BY and SKIP applied.
 /// </returns>
 /// <param name="keys">The key columns by which to order the results.</param>
 /// <param name="count">The number of results to skip. This must be either a constant or a parameter reference.</param>
 /// <param name="parameters">An optional set of query parameters that should be in scope when parsing.</param>
 /// <exception cref="T:System.ArgumentNullException">Any argument is null.</exception>
 /// <exception cref="T:System.ArgumentException"> keys  is an empty string or count  is an empty string.</exception>
 public ObjectQuery <T> Skip(
     string keys,
     string count,
     params ObjectParameter[] parameters)
 {
     Check.NotEmpty(keys, nameof(keys));
     Check.NotEmpty(count, nameof(count));
     Check.NotNull <ObjectParameter[]>(parameters, nameof(parameters));
     return(new ObjectQuery <T>(EntitySqlQueryBuilder.Skip(this.QueryState, this.Name, keys, count, parameters)));
 }
        /// <summary>
        ///   This query-builder method creates a new query whose results are the
        ///   results of this query, ordered by some criteria and with the specified
        ///   number of results 'skipped', or paged-over.
        /// </summary>
        /// <param name="keys">
        ///   The sort keys.
        /// </param>
        /// <param name="count">
        ///   Specifies the number of results to skip. This must be either a constant or
        ///   a parameter reference.
        /// </param>
        /// <param name="parameters">
        ///   An optional set of query parameters that should be in scope when parsing.
        /// </param>
        /// <returns>
        ///   a new ObjectQuery instance.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///   If any argument is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///   If the sort key or skip count command text is empty.
        /// </exception>
        public ObjectQuery <T> Skip(string keys, string count, params ObjectParameter[] parameters)
        {
            EntityUtil.CheckArgumentNull(keys, "keys");
            EntityUtil.CheckArgumentNull(count, "count");
            EntityUtil.CheckArgumentNull(parameters, "parameters");

            if (StringUtil.IsNullOrEmptyOrWhiteSpace(keys))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.ObjectQuery_QueryBuilder_InvalidSortKeyList, "keys");
            }

            if (StringUtil.IsNullOrEmptyOrWhiteSpace(count))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.ObjectQuery_QueryBuilder_InvalidSkipCount, "count");
            }

            return(new ObjectQuery <T>(EntitySqlQueryBuilder.Skip(this.QueryState, this.Name, keys, count, parameters)));
        }