Esempio n. 1
0
        internal static DbQueryCommandTree FromValidExpression(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query)
        {
#if DEBUG
            return(new DbQueryCommandTree(metadata, dataSpace, query));
#else
            return(new DbQueryCommandTree(metadata, dataSpace, query, false));
#endif
        }
Esempio n. 2
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>
 /// <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)
     : this(metadata, dataSpace, query, true)
 {
 }
Esempio n. 3
0
        internal DbIsOfExpression(DbExpressionKind isOfKind, TypeUsage booleanResultType, DbExpression argument, TypeUsage isOfType)
            : base(isOfKind, booleanResultType, argument)
        {
            Debug.Assert(
                DbExpressionKind.IsOf == ExpressionKind || DbExpressionKind.IsOfOnly == ExpressionKind,
                string.Format(
                    CultureInfo.InvariantCulture, "Invalid DbExpressionKind used in DbIsOfExpression: {0}",
                    Enum.GetName(typeof(DbExpressionKind), ExpressionKind)));
            Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbIsOfExpression requires a Boolean result type");

            _ofType = isOfType;
        }
Esempio n. 4
0
        internal DbLikeExpression(TypeUsage booleanResultType, DbExpression input, DbExpression pattern, DbExpression escape)
            : base(DbExpressionKind.Like, booleanResultType)
        {
            DebugCheck.NotNull(input);
            DebugCheck.NotNull(pattern);
            DebugCheck.NotNull(escape);
            Debug.Assert(
                TypeSemantics.IsPrimitiveType(input.ResultType, PrimitiveTypeKind.String),
                "DbLikeExpression argument must have a string result type");
            Debug.Assert(
                TypeSemantics.IsPrimitiveType(pattern.ResultType, PrimitiveTypeKind.String),
                "DbLikeExpression pattern must have a string result type");
            Debug.Assert(
                TypeSemantics.IsPrimitiveType(escape.ResultType, PrimitiveTypeKind.String),
                "DbLikeExpression escape must have a string result type");
            Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbLikeExpression must have a Boolean result type");

            _argument = input;
            _pattern  = pattern;
            _escape   = escape;
        }
Esempio n. 5
0
        /// <summary>
        /// Called when an <see cref="DbExpression" /> of an otherwise unrecognized type is encountered.
        /// </summary>
        /// <param name="expression"> The expression </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="expression" />
        /// is null
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// Always thrown if this method is called, since it indicates that
        /// <paramref name="expression" />
        /// is of an unsupported type
        /// </exception>
        public override void Visit(DbExpression expression)
        {
            Check.NotNull(expression, "expression");

            throw new NotSupportedException(Strings.Cqt_General_UnsupportedExpression(expression.GetType().FullName));
        }
 internal DbExceptExpression(TypeUsage resultType, DbExpression left, DbExpression right)
     : base(DbExpressionKind.Except, resultType, left, right)
 {
     Debug.Assert(
         ReferenceEquals(resultType, left.ResultType), "DbExceptExpression result type should be result type of left argument");
 }
Esempio n. 7
0
 internal DbIsEmptyExpression(TypeUsage booleanResultType, DbExpression argument)
     : base(DbExpressionKind.IsEmpty, booleanResultType, argument)
 {
     Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbIsEmptyExpression requires a Boolean result type");
 }
Esempio n. 8
0
 /// <summary>
 /// Convenience method to visit the specified <see cref="DbExpression" />, if non-null.
 /// </summary>
 /// <param name="expression"> The expression to visit. </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="expression" />
 /// is null
 /// </exception>
 public virtual void VisitExpression(DbExpression expression)
 {
     // #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here.
     Check.NotNull(expression, "expression");
     expression.Accept(this);
 }
Esempio n. 9
0
 internal DbComparisonExpression(DbExpressionKind kind, TypeUsage booleanResultType, DbExpression left, DbExpression right)
     : base(kind, booleanResultType, left, right)
 {
     DebugCheck.NotNull(left);
     DebugCheck.NotNull(right);
     Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbComparisonExpression result type must be a Boolean type");
     Debug.Assert(
         DbExpressionKind.Equals == kind ||
         DbExpressionKind.LessThan == kind ||
         DbExpressionKind.LessThanOrEquals == kind ||
         DbExpressionKind.GreaterThan == kind ||
         DbExpressionKind.GreaterThanOrEquals == kind ||
         DbExpressionKind.NotEquals == kind,
         "Invalid DbExpressionKind used in DbComparisonExpression: " + Enum.GetName(typeof(DbExpressionKind), kind)
         );
 }
Esempio n. 10
0
 internal DbUnionAllExpression(TypeUsage resultType, DbExpression left, DbExpression right)
     : base(DbExpressionKind.UnionAll, resultType, left, right)
 {
 }
 internal DbElementExpression(TypeUsage resultType, DbExpression argument, bool unwrapSingleProperty)
     : base(DbExpressionKind.Element, resultType, argument)
 {
     _singlePropertyUnwrapped = unwrapSingleProperty;
 }
Esempio n. 12
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)
     : this(metadata, dataSpace, query, validate, useDatabaseNullSemantics, false)
 {
 }
Esempio n. 13
0
        internal static DbQueryCommandTree FromValidExpression(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query,
                                                               bool useDatabaseNullSemantics, bool disableFilterOverProjectionSimplificationForCustomFunctions)
        {
            return(new DbQueryCommandTree(metadata, dataSpace, query,
#if DEBUG
                                          true,
#else
                                          false,
#endif
                                          useDatabaseNullSemantics,
                                          disableFilterOverProjectionSimplificationForCustomFunctions));
        }
Esempio n. 14
0
 /// <summary>
 /// Constructs a new DbQueryCommandTree that uses the specified metadata workspace, using database null semantics.
 /// </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)
     : this(metadata, dataSpace, query, validate, true, false)
 {
 }
Esempio n. 15
0
 /// <summary>When overridden in a derived class, handles any expression of an unrecognized type.</summary>
 /// <returns>A result value of a specific type.</returns>
 /// <param name="expression">
 /// The <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbExpression" /> that is being visited.
 /// </param>
 public abstract TResultType Visit(DbExpression expression);