public IOqlSyntaxContext InitializeFor(Expression expression) { if (expression.NodeType == ExpressionType.Call) { m_call_result.Command = OqlCommandToken.Exec; MethodCallExpression methodCall = expression as MethodCallExpression; if (methodCall.IsCalled(OqlInsertClause.Insert)) { return(ForInsert()); } if (methodCall.IsCalled(OqlUpdateClause.Update)) { return(ForUpdate()); } if (methodCall.IsCalled(OqlDeleteClause.Delete)) { return(ForDelete()); } } m_call_result.Command = OqlCommandToken.Select; return(ForSelect()); }
public override void ProcessMethodCall(IOqlSyntaxContext callContext, MethodCallExpression methodCall) { if (methodCall.IsCalled(Skip)) { callContext.CallResult.Offset = (int)methodCall.GetArgument(1).GetValue(); return; } if (methodCall.IsCalled(Take)) { callContext.CallResult.Size = (int)methodCall.GetArgument(1).GetValue(); return; } if (methodCall.IsCalled(ElementAt)) { callContext.CallResult.Command = OqlCommandToken.ElementAt; callContext.CallResult.ElementIndex = (int)methodCall.GetArgument(1).GetValue(); return; } if (methodCall.IsCalled(ElementAtOrDefault)) { callContext.CallResult.ElementIndex = (int)methodCall.GetArgument(1).GetValue(); callContext.CallResult.Command = OqlCommandToken.ElementAt | OqlCommandToken.DefaultFlag; return; } ProcessNavigate(callContext, methodCall); }
public override void ProcessMethodCall(IOqlSyntaxContext callContext, MethodCallExpression methodCall) { if (methodCall.IsCalled(OuterJoin)) { } if (methodCall.IsCalled(InnerJoin)) { } }
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; }
public static bool IsCalledOr(this MethodCallExpression @this, params IMethod[] methods) { foreach (IMethod m in methods) { if (@this.IsCalled(m)) { return(true); } } return(false); }
public override void ProcessMethodCall(IOqlSyntaxContext callContext, MethodCallExpression methodCall) { if (methodCall.IsCalled(SkipWhile)) { AndAlso(Expression.Not(methodCall.GetArgument(1))); return; } AndAlso(methodCall.GetArgument(1)); OqlNavigationClause.ProcessNavigate(callContext, methodCall); }