/// <summary>
        /// Creates a new copy of the specified parameter collection containing copies of its element <see cref="ObjectParameter"/>s.
        /// If the specified argument is <c>null</c>, then <c>null</c> is returned.
        /// </summary>
        /// <param name="copyParams">The parameter collection to copy</param>
        /// <returns>The new collection containing copies of <paramref name="copyParams"/> parameters, if <paramref name="copyParams"/> is non-null; otherwise <c>null</c>.</returns>
        internal static ObjectParameterCollection DeepCopy(ObjectParameterCollection copyParams)
        {
            if (null == copyParams)
            {
                return(null);
            }

            ObjectParameterCollection retParams = new ObjectParameterCollection(copyParams._perspective);

            foreach (ObjectParameter param in copyParams)
            {
                retParams.Add(param.ShallowCopy());
            }

            return(retParams);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new query EntitySqlQueryState instance.
        /// </summary>
        /// <param name="context">
        ///     The ObjectContext containing the metadata workspace the query was
        ///     built against, the connection on which to execute the query, and the
        ///     cache to store the results in. Must not be null.
        /// </param>
        /// <param name="commandText">
        ///     The Entity-SQL text of the query
        /// </param>
        /// <param name="expression">
        ///     Optional <see cref="DbExpression"/> that defines the query. Must be semantically equal to the <paramref name="commandText"/>.
        /// </param>
        /// <param name="mergeOption">
        ///     The merge option to use when retrieving results if an explicit merge option is not specified
        /// </param>
        internal EntitySqlQueryState(Type elementType, string commandText, DbExpression expression, bool allowsLimit, ObjectContext context, ObjectParameterCollection parameters, Span span)
            : base(elementType, context, parameters, span)
        {
            EntityUtil.CheckArgumentNull(commandText, "commandText");
            if (string.IsNullOrEmpty(commandText))
            {
                throw EntityUtil.Argument(System.Data.Entity.Strings.ObjectQuery_InvalidEmptyQuery, "commandText");
            }

            _queryText       = commandText;
            _queryExpression = expression;
            _allowsLimit     = allowsLimit;
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new query EntitySqlQueryState instance.
 /// </summary>
 /// <param name="context">
 ///     The ObjectContext containing the metadata workspace the query was
 ///     built against, the connection on which to execute the query, and the
 ///     cache to store the results in. Must not be null.
 /// </param>
 /// <param name="commandText">
 ///     The Entity-SQL text of the query
 /// </param>
 /// <param name="mergeOption">
 ///     The merge option to use when retrieving results if an explicit merge option is not specified
 /// </param>
 internal EntitySqlQueryState(Type elementType, string commandText, bool allowsLimit, ObjectContext context, ObjectParameterCollection parameters, Span span)
     : this(elementType, commandText, /*expression*/ null, allowsLimit, context, parameters, span)
 {
 }
Esempio n. 4
0
        internal override ObjectQueryState Include <TElementType>(ObjectQuery <TElementType> sourceQuery, string includePath)
        {
            ObjectQueryState retState = new EntitySqlQueryState(this.ElementType, _queryText, _queryExpression, _allowsLimit, this.ObjectContext, ObjectParameterCollection.DeepCopy(this.Parameters), Span.IncludeIn(this.Span, includePath));

            this.ApplySettingsTo(retState);
            return(retState);
        }