public void Remove_throws_for_null_argument()
        {
            var objectParameterCollection = new ObjectParameterCollection(new ClrPerspective(new MetadataWorkspace()));

            Assert.Equal(
                "item",
                Assert.Throws <ArgumentNullException>(
                    () => objectParameterCollection.Remove(null)).ParamName);
        }
 internal EntitySqlQueryState(
     Type elementType,
     string commandText,
     bool allowsLimit,
     ObjectContext context,
     ObjectParameterCollection parameters,
     Span span)
     : this(elementType, commandText, (DbExpression)null, allowsLimit, context, parameters, span, (ObjectQueryExecutionPlanFactory)null)
 {
 }
Exemplo n.º 3
0
        // <summary>
        // Initializes a new query EntitySqlQueryState instance.
        // </summary>
        // <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="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>
        internal EntitySqlQueryState(
            Type elementType, string commandText, DbExpression expression, bool allowsLimit, ObjectContext context,
            ObjectParameterCollection parameters, Span span,
            ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory = null)
            : base(elementType, context, parameters, span)
        {
            Check.NotEmpty(commandText, "commandText");

            _queryText       = commandText;
            _queryExpression = expression;
            _allowsLimit     = allowsLimit;
            _objectQueryExecutionPlanFactory = objectQueryExecutionPlanFactory ?? new ObjectQueryExecutionPlanFactory();
        }
        internal static ObjectParameterCollection DeepCopy(
            ObjectParameterCollection copyParams)
        {
            if (copyParams == null)
            {
                return((ObjectParameterCollection)null);
            }
            ObjectParameterCollection parameterCollection = new ObjectParameterCollection(copyParams._perspective);

            foreach (ObjectParameter copyParam in copyParams)
            {
                parameterCollection.Add(copyParam.ShallowCopy());
            }
            return(parameterCollection);
        }
Exemplo n.º 5
0
        // <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);
            }

            var retParams = new ObjectParameterCollection(copyParams._perspective);

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

            return(retParams);
        }
 internal EntitySqlQueryState(
     Type elementType,
     string commandText,
     DbExpression expression,
     bool allowsLimit,
     ObjectContext context,
     ObjectParameterCollection parameters,
     Span span,
     ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory = null)
     : base(elementType, context, parameters, span)
 {
     Check.NotEmpty(commandText, nameof(commandText));
     this._queryText       = commandText;
     this._queryExpression = expression;
     this._allowsLimit     = allowsLimit;
     this._objectQueryExecutionPlanFactory = objectQueryExecutionPlanFactory ?? new ObjectQueryExecutionPlanFactory((System.Data.Entity.Core.Common.Internal.Materialization.Translator)null);
 }
Exemplo n.º 7
0
 // <summary>
 // Initializes a new query EntitySqlQueryState instance.
 // </summary>
 // <param name="commandText"> The Entity-SQL text of the query </param>
 // <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>
 internal EntitySqlQueryState(
     Type elementType, string commandText, bool allowsLimit, ObjectContext context, ObjectParameterCollection parameters, Span span)
     : this(elementType, commandText, /*expression*/ null, allowsLimit, context, parameters, span)
 {
 }
Exemplo n.º 8
0
        internal override ObjectQueryState Include <TElementType>(ObjectQuery <TElementType> sourceQuery, string includePath)
        {
            ObjectQueryState retState = new EntitySqlQueryState(
                ElementType, _queryText, _queryExpression, _allowsLimit, ObjectContext, ObjectParameterCollection.DeepCopy(Parameters),
                Span.IncludeIn(Span, includePath));

            ApplySettingsTo(retState);
            return(retState);
        }
        internal override ObjectQueryState Include <TElementType>(
            ObjectQuery <TElementType> sourceQuery,
            string includePath)
        {
            ObjectQueryState other = (ObjectQueryState) new EntitySqlQueryState(this.ElementType, this._queryText, this._queryExpression, this._allowsLimit, this.ObjectContext, ObjectParameterCollection.DeepCopy(this.Parameters), Span.IncludeIn(this.Span, includePath), (ObjectQueryExecutionPlanFactory)null);

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