Example #1
0
        /// <summary>Limits the query results to only the properties that are defined in the specified projection.</summary>
        /// <returns>
        /// A new <see cref="T:System.Data.Entity.Core.Objects.ObjectQuery`1" /> instance of type
        /// <see
        ///     cref="T:System.Data.Common.DbDataRecord" />
        /// that is equivalent to the original instance with SELECT applied.
        /// </returns>
        /// <param name="projection">The list of selected properties that defines the projection.</param>
        /// <param name="parameters">Zero or more parameters that are used in this method.</param>
        /// <exception cref="T:System.ArgumentNullException"> projection  is null or parameters is null.</exception>
        /// <exception cref="T:System.ArgumentException">The  projection  is an empty string.</exception>
        public ObjectQuery <DbDataRecord> Select(string projection, params ObjectParameter[] parameters)
        {
            Check.NotEmpty(projection, "projection");
            Check.NotNull(parameters, "parameters");

            return(new ObjectQuery <DbDataRecord>(EntitySqlQueryBuilder.Select(QueryState, Name, projection, parameters)));
        }
 /// <summary>Limits the query results to only the properties that are defined in the specified projection.</summary>
 /// <returns>
 /// A new <see cref="T:System.Data.Entity.Core.Objects.ObjectQuery`1" /> instance of type
 /// <see cref="T:System.Data.Common.DbDataRecord" />
 /// that is equivalent to the original instance with SELECT applied.
 /// </returns>
 /// <param name="projection">The list of selected properties that defines the projection.</param>
 /// <param name="parameters">Zero or more parameters that are used in this method.</param>
 /// <exception cref="T:System.ArgumentNullException"> projection  is null or parameters is null.</exception>
 /// <exception cref="T:System.ArgumentException">The  projection  is an empty string.</exception>
 public ObjectQuery <DbDataRecord> Select(
     string projection,
     params ObjectParameter[] parameters)
 {
     Check.NotEmpty(projection, nameof(projection));
     Check.NotNull <ObjectParameter[]>(parameters, nameof(parameters));
     return(new ObjectQuery <DbDataRecord>(EntitySqlQueryBuilder.Select(this.QueryState, this.Name, projection, parameters)));
 }
        /// <summary>
        ///   This query-builder method creates a new query whose results are data
        ///   records containing selected fields of the results of this query.
        /// </summary>
        /// <param name="projection">
        ///   The projection list.
        /// </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 either argument is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///   If the projection list command text is empty.
        /// </exception>
        public ObjectQuery <DbDataRecord> Select(string projection, params ObjectParameter[] parameters)
        {
            EntityUtil.CheckArgumentNull(projection, "projection");
            EntityUtil.CheckArgumentNull(parameters, "parameters");

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

            return(new ObjectQuery <DbDataRecord>(EntitySqlQueryBuilder.Select(this.QueryState, this.Name, projection, parameters)));
        }