Example #1
0
        internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            int num  = (int)this.skipAmount.Value;
            int num2 = (int)((SkipQueryOptionExpression)previous).skipAmount.Value;

            return(new SkipQueryOptionExpression(this.Type, Expression.Constant(num + num2, typeof(int))));
        }
 internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     int num = (int) this.takeAmount.Value;
     int num2 = (int) ((TakeQueryOptionExpression) previous).takeAmount.Value;
     if (num >= num2)
     {
         return previous;
     }
     return this;
 }
        internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            int num  = (int)this.takeAmount.Value;
            int num2 = (int)((TakeQueryOptionExpression)previous).takeAmount.Value;

            if (num >= num2)
            {
                return(previous);
            }
            return(this);
        }
 /// <summary>
 /// Composes the <paramref name="previous"/> expression with this one when it's specified multiple times.
 /// </summary>
 /// <param name="previous"><see cref="QueryOptionExpression"/> to compose.</param>
 /// <returns>
 /// The expression that results from composing the <paramref name="previous"/> expression with this one.
 /// </returns>
 internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     Debug.Assert(previous != null, "other != null");
     Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
     Debug.Assert(this.takeAmount != null, "this.takeAmount != null");
     Debug.Assert(
         this.takeAmount.Type == typeof(int),
         "this.takeAmount.Type == typeof(int) -- otherwise it wouldn't have matched the Enumerable.Take(source, int count) signature");
     int thisValue = (int)this.takeAmount.Value;
     int previousValue = (int)((TakeQueryOptionExpression)previous).takeAmount.Value;
     return (thisValue < previousValue) ? this : previous;
 }
 /// <summary>
 /// Composes the <paramref name="previous"/> expression with this one when it's specified multiple times.
 /// </summary>
 /// <param name="previous"><see cref="QueryOptionExpression"/> to compose.</param>
 /// <returns>
 /// The expression that results from composing the <paramref name="previous"/> expression with this one.
 /// </returns>
 internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     Debug.Assert(previous != null, "other != null");
     Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
     Debug.Assert(this.skipAmount != null, "this.skipAmount != null");
     Debug.Assert(
         this.skipAmount.Type == typeof(int),
         "this.skipAmount.Type == typeof(int) -- otherwise it wouldn't have matched the Enumerable.Skip(source, int count) signature");
     int thisValue = (int)this.skipAmount.Value;
     int previousValue = (int)((SkipQueryOptionExpression)previous).skipAmount.Value;
     return new SkipQueryOptionExpression(this.Type, Expression.Constant(thisValue + previousValue, typeof(int)));
 }
Example #6
0
 internal void AddSequenceQueryOption(QueryOptionExpression qoe)
 {
     QueryOptionExpression previous = (from o in this.sequenceQueryOptions
         where o.GetType() == qoe.GetType()
         select o).FirstOrDefault<QueryOptionExpression>();
     if (previous != null)
     {
         qoe = qoe.ComposeMultipleSpecification(previous);
         this.sequenceQueryOptions.Remove(previous);
     }
     this.sequenceQueryOptions.Add(qoe);
 }
        internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            Debug.Assert(previous != null, "other != null");
            Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
            Debug.Assert(this.takeAmount != null, "this.takeAmount != null");
            Debug.Assert(
                this.takeAmount.Type == typeof(int),
                "this.takeAmount.Type == typeof(int) -- otherwise it wouldn't have matched the Enumerable.Take(source, int count) signature");
            int thisValue     = (int)this.takeAmount.Value;
            int previousValue = (int)((TakeQueryOptionExpression)previous).takeAmount.Value;

            return((thisValue < previousValue) ? this : previous);
        }
        /// <summary>
        /// Add query option to resource expression
        /// </summary>
        internal void AddSequenceQueryOption(QueryOptionExpression qoe)
        {
            Debug.Assert(qoe != null, "qoe != null");
            QueryOptionExpression old = this.sequenceQueryOptions.Where(o => o.GetType() == qoe.GetType()).FirstOrDefault();

            if (old != null)
            {
                qoe = qoe.ComposeMultipleSpecification(old);
                this.sequenceQueryOptions.Remove(old);
            }

            this.sequenceQueryOptions.Add(qoe);
        }
        /// <summary>
        /// Composes the <paramref name="previous"/> expression with this one when it's specified multiple times.
        /// </summary>
        /// <param name="previous"><see cref="QueryOptionExpression"/> to compose.</param>
        /// <returns>
        /// The expression that results from composing the <paramref name="previous"/> expression with this one.
        /// </returns>
        internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            Debug.Assert(previous != null, "other != null");
            Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
            Debug.Assert(this.skipAmount != null, "this.skipAmount != null");
            Debug.Assert(
                this.skipAmount.Type == typeof(int),
                "this.skipAmount.Type == typeof(int) -- otherwise it wouldn't have matched the Enumerable.Skip(source, int count) signature");
            int thisValue     = (int)this.skipAmount.Value;
            int previousValue = (int)((SkipQueryOptionExpression)previous).skipAmount.Value;

            return(new SkipQueryOptionExpression(this.Type, Expression.Constant(thisValue + previousValue, typeof(int))));
        }
Example #10
0
        internal void AddSequenceQueryOption(QueryOptionExpression qoe)
        {
            QueryOptionExpression previous = (from o in this.sequenceQueryOptions
                                              where o.GetType() == qoe.GetType()
                                              select o).FirstOrDefault <QueryOptionExpression>();

            if (previous != null)
            {
                qoe = qoe.ComposeMultipleSpecification(previous);
                this.sequenceQueryOptions.Remove(previous);
            }
            this.sequenceQueryOptions.Add(qoe);
        }
#pragma warning restore 618

        /// <summary>
        /// Composes the <paramref name="previous"/> expression with this one when it's specified multiple times.
        /// </summary>
        /// <param name="previous"><see cref="QueryOptionExpression"/> to compose.</param>
        /// <returns>
        /// The expression that results from composing the <paramref name="previous"/> expression with this one.
        /// </returns>
        internal virtual QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            Debug.Assert(previous != null, "other != null");
            Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
            return this;
        }
Example #12
0
#pragma warning restore 618

        internal virtual QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
        {
            Debug.Assert(previous != null, "other != null");
            Debug.Assert(previous.GetType() == this.GetType(), "other.GetType == this.GetType() -- otherwise it's not the same specification");
            return(this);
        }
        internal void AddSequenceQueryOption(QueryOptionExpression qoe)
        {
            Debug.Assert(qoe != null, "qoe != null");
            QueryOptionExpression old = this.sequenceQueryOptions.Where(o => o.GetType() == qoe.GetType()).FirstOrDefault();
            if (old != null)
            {
                qoe = qoe.ComposeMultipleSpecification(old);
                this.sequenceQueryOptions.Remove(old);
            }

            this.sequenceQueryOptions.Add(qoe);
        }
Example #14
0
 internal virtual QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     return this;
 }
Example #15
0
 internal virtual QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     return(this);
 }
 internal override QueryOptionExpression ComposeMultipleSpecification(QueryOptionExpression previous)
 {
     int num = (int) this.skipAmount.Value;
     int num2 = (int) ((SkipQueryOptionExpression) previous).skipAmount.Value;
     return new SkipQueryOptionExpression(this.Type, Expression.Constant(num + num2, typeof(int)));
 }