protected virtual void VisitOrderBy(IOqlExpressionVisitor visitor, MethodCallExpression methodCall) { visitor.Visit(methodCall.GetArgument(1)); if (methodCall.IsCalledOr(OrderBy, ThenBy)) { visitor.Query.AppendAsc(); return; } if (methodCall.IsCalledOr(OrderByDescending, ThenByDescending)) { visitor.Query.AppendDesc(); } }
public static void ProcessNavigate(IOqlSyntaxContext callContext, MethodCallExpression methodCall) { callContext.CallResult.ResultType = methodCall.Type; if (methodCall.IsCalledOr(AnyWithPredicate, AnyWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.IsAny; return; } if (methodCall.IsCalledOr(FirstWithPredicate, FirstWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.First; return; } if (methodCall.IsCalledOr(FirstOrDefaultWithPredicate, FirstOrDefaultWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.First | OqlCommandToken.DefaultFlag; return; } if (methodCall.IsCalledOr(SingleWithPredicate, SingleWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.Single; return; } if (methodCall.IsCalledOr(SingleOrDefaultWithPredicate, SingleOrDefaultWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.Single | OqlCommandToken.DefaultFlag; return; } if (methodCall.IsCalledOr(LastWithPredicate, LastWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.Last; return; } if (methodCall.IsCalledOr(LastOrDefaultWithPredicate, LastOrDefaultWithoutPredicate)) { callContext.CallResult.Command = OqlCommandToken.Last | OqlCommandToken.DefaultFlag; return; } if (methodCall.IsCalledOr(CountWithPredicate, LongCountWithPredicate)) { callContext.CallResult.Command = OqlCommandToken.Scalar; return; } }
public override void ProcessMethodCall(IOqlSyntaxContext callContext, MethodCallExpression methodCall) { if (Distinct.Equals(methodCall)) { m_has_distinct = true; return; } m_select_expression = methodCall.GetArgument(1); callContext.CallResult.ResultType = methodCall.Type; if (m_select_expression.NodeType == ExpressionType.MemberInit || m_select_expression.NodeType == ExpressionType.New) { return; } if (methodCall.IsCalled(Min)) { visit_to_aggregate = (x, y) => callContext.AggregateFormatter.FormatMin(x, y); return; } if (methodCall.IsCalled(Max)) { visit_to_aggregate = (x, y) => callContext.AggregateFormatter.FormatMax(x, y); return; } if (methodCall.IsCalled("Average")) { visit_to_aggregate = (x, y) => callContext.AggregateFormatter.FormatAverage(x, y); return; } if (methodCall.IsCalled("Sum")) { visit_to_aggregate = (x, y) => callContext.AggregateFormatter.FormatSum(x, y); return; } if (methodCall.IsCalledOr(Count, LongCount)) { callContext.CallResult.Command = OqlCommandToken.Scalar; } visit_to_aggregate = null; }