/// <summary>
        /// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
        /// </summary>
        /// <param name="metadata">The metadata workspace that the command tree should use.</param>
        /// <param name="dataSpace">The logical 'space' that metadata in the expressions used in this command tree must belong to.</param>
        /// <param name="query">A <see cref="DbExpression"/> that defines the logic of the query.</param>
        /// <param name="validate">When set to false the validation of the tree is turned off.</param>
        /// <exception cref="ArgumentNullException"><paramref name="metadata"/> or <paramref name="query"/> is null</exception>
        /// <exception cref="ArgumentException"><paramref name="dataSpace"/> does not represent a valid data space</exception>
        public DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate)
            : base(metadata, dataSpace)
        {
            // Ensure the query expression is non-null
            Contract.Requires(query != null);

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                var validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                _parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly();
            }
            _query = query;
        }
        /// <summary>
        ///     Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
        /// </summary>
        /// <param name="metadata"> The metadata workspace that the command tree should use. </param>
        /// <param name="dataSpace"> The logical 'space' that metadata in the expressions used in this command tree must belong to. </param>
        /// <param name="query">
        ///     A <see cref="DbExpression" /> that defines the logic of the query.
        /// </param>
        /// <param name="validate"> When set to false the validation of the tree is turned off. </param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="metadata" />
        ///     or
        ///     <paramref name="query" />
        ///     is null
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     <paramref name="dataSpace" />
        ///     does not represent a valid data space
        /// </exception>
        public DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate)
            : base(metadata, dataSpace)
        {
            // Ensure the query expression is non-null
            Check.NotNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                var validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                _parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly();
            }
            _query = query;
        }
Пример #3
0
        /// <summary>
        /// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
        /// </summary>
        /// <param name="metadata"> The metadata workspace that the command tree should use. </param>
        /// <param name="dataSpace"> The logical 'space' that metadata in the expressions used in this command tree must belong to. </param>
        /// <param name="query">
        /// A <see cref="DbExpression" /> that defines the logic of the query.
        /// </param>
        /// <param name="validate"> When set to false the validation of the tree is turned off. </param>
        /// <param name="useDatabaseNullSemantics">A boolean that indicates whether database null semantics are exhibited when comparing
        /// two operands, both of which are potentially nullable.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="metadata" />
        /// or
        /// <paramref name="query" />
        /// is null
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="dataSpace" />
        /// does not represent a valid data space
        /// </exception>
        public DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate, bool useDatabaseNullSemantics)
            : base(metadata, dataSpace, useDatabaseNullSemantics)
        {
            // Ensure the query expression is non-null
            Check.NotNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                var validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                _parameters = new ReadOnlyCollection <DbParameterReferenceExpression>(
                    validator.Parameters.Select(paramInfo => paramInfo.Value).ToList());
            }
            _query = query;
        }
Пример #4
0
 /// <summary>
 /// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
 /// </summary>
 /// <param name="metadata"> The metadata workspace that the command tree should use. </param>
 /// <param name="dataSpace"> The logical 'space' that metadata in the expressions used in this command tree must belong to. </param>
 /// <param name="query">
 /// A <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbExpression" /> that defines the logic of the query.
 /// </param>
 /// <param name="validate"> When set to false the validation of the tree is turned off. </param>
 /// <param name="useDatabaseNullSemantics">A boolean that indicates whether database null semantics are exhibited when comparing
 /// two operands, both of which are potentially nullable.</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="metadata" />
 /// or
 /// <paramref name="query" />
 /// is null
 /// </exception>
 /// <exception cref="T:System.ArgumentException">
 /// <paramref name="dataSpace" />
 /// does not represent a valid data space
 /// </exception>
 public DbQueryCommandTree(
     MetadataWorkspace metadata,
     DataSpace dataSpace,
     DbExpression query,
     bool validate,
     bool useDatabaseNullSemantics)
     : base(metadata, dataSpace, useDatabaseNullSemantics)
 {
     Check.NotNull <DbExpression>(query, nameof(query));
     if (validate)
     {
         DbExpressionValidator expressionValidator = new DbExpressionValidator(metadata, dataSpace);
         expressionValidator.ValidateExpression(query, nameof(query));
         this._parameters = new ReadOnlyCollection <DbParameterReferenceExpression>((IList <DbParameterReferenceExpression>)expressionValidator.Parameters.Select <KeyValuePair <string, DbParameterReferenceExpression>, DbParameterReferenceExpression>((Func <KeyValuePair <string, DbParameterReferenceExpression>, DbParameterReferenceExpression>)(paramInfo => paramInfo.Value)).ToList <DbParameterReferenceExpression>());
     }
     this._query = query;
 }
        /// <summary>
        /// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
        /// </summary>
        /// <param name="metadata"> The metadata workspace that the command tree should use. </param>
        /// <param name="dataSpace"> The logical 'space' that metadata in the expressions used in this command tree must belong to. </param>
        /// <param name="query">
        /// A <see cref="DbExpression" /> that defines the logic of the query.
        /// </param>
        /// <param name="validate"> When set to false the validation of the tree is turned off. </param>
        /// <param name="useDatabaseNullSemantics">A boolean that indicates whether database null semantics are exhibited when comparing
        /// two operands, both of which are potentially nullable.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="metadata" />
        /// or
        /// <paramref name="query" />
        /// is null
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="dataSpace" />
        /// does not represent a valid data space
        /// </exception>
        public DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate, bool useDatabaseNullSemantics)
            : base(metadata, dataSpace, useDatabaseNullSemantics)
        {
            // Ensure the query expression is non-null
            Check.NotNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                var validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                _parameters = new ReadOnlyCollection<DbParameterReferenceExpression>(
                    validator.Parameters.Select(paramInfo => paramInfo.Value).ToList());
            }
            _query = query;
        }
Пример #6
0
        private DbQueryCommandTree(MetadataWorkspace metadata,
                                   DataSpace dataSpace, 
                                   DbExpression query,
                                   bool validate)
            : base(metadata, dataSpace)
        {
            // Ensure the query expression is non-null
            EntityUtil.CheckArgumentNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                DbExpressionValidator validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                this._parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly();
            }
            this._query = query;
        }
        private DbQueryCommandTree(MetadataWorkspace metadata,
                                   DataSpace dataSpace,
                                   DbExpression query,
                                   bool validate)
            : base(metadata, dataSpace)
        {
            // Ensure the query expression is non-null
            EntityUtil.CheckArgumentNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                DbExpressionValidator validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                this._parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly();
            }
            this._query = query;
        }