예제 #1
0
        private static bool ProcessTake(
            SqlSelect sqlSelect, TakeResultOperator takeResultOperator)
        {
            sqlSelect.AddLimit(takeResultOperator.GetConstantCount());

            return(false);
        }
예제 #2
0
        private static bool ProcessTake(
            SelectExpression selectExpression, TakeResultOperator takeResultOperator)
        {
            selectExpression.AddLimit(takeResultOperator.GetConstantCount());

            return(false);
        }
 /// <summary>
 /// Visits the result operator.
 /// </summary>
 /// <param name="resultOperator">Result operator.</param>
 /// <param name="queryModel">Query model.</param>
 /// <param name="index">Index.</param>
 public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
 {
     if (resultOperator is SkipResultOperator)
     {
         SkipResultOperator @operator = resultOperator as SkipResultOperator;
         this.commandBuilder.LimitParts.From = @operator.GetConstantCount();
     }
     else if (resultOperator is TakeResultOperator)
     {
         TakeResultOperator @operator = resultOperator as TakeResultOperator;
         this.commandBuilder.LimitParts.Count = @operator.GetConstantCount();
     }
     else if (resultOperator is CountResultOperator || resultOperator is LongCountResultOperator)
     {
         this.commandBuilder.IsCount = true;
     }
     else if (resultOperator is FirstResultOperator || resultOperator is SingleResultOperator)
     {
     }
     else if (resultOperator is DistinctResultOperator)
     {
         this.commandBuilder.IsDistinct = true;
     }
     else
     {
         if (resultOperator is AverageResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is MaxResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is MinResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is SumResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is ContainsResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is DefaultIfEmptyResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is ExceptResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is GroupResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is IntersectResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is OfTypeResultOperator)
         {
             throw new NotSupportedException();
         }
         if (resultOperator is UnionResultOperator)
         {
             throw new NotSupportedException();
         }
     }
 }
예제 #4
0
        public void GetConstantCount_NoConstantExpression()
        {
            var resultOperator = new TakeResultOperator(new QuerySourceReferenceExpression(ExpressionHelper.CreateMainFromClause_Int()));

            resultOperator.GetConstantCount();
        }
예제 #5
0
 public void GetConstantCount()
 {
     Assert.That(_resultOperator.GetConstantCount(), Is.EqualTo(2));
 }
예제 #6
0
 public void GetConstantCount_NoConstantExpression ()
 {
   var resultOperator = new TakeResultOperator (new QuerySourceReferenceExpression (ExpressionHelper.CreateMainFromClause_Int ()));
   resultOperator.GetConstantCount ();
 }
예제 #7
0
        private void ProcessTakeOperator(TakeResultOperator resultOperator)
		{
			_additionalCriteria.Add(q => q.SetMaxResults(resultOperator.GetConstantCount()));
		}