private bool TryProcessWhereMethod(MethodInvocationExpression methodInvoke, bool queryable)
 {
     if (!this.TryProcessSingleParameterQuery(methodInvoke, true, queryable, out V_0))
     {
         return(false);
     }
     this.clauses.Add(new WhereClause(V_0, methodInvoke.get_InvocationInstructions()));
     return(true);
 }
 private bool TryProcessSelectMethod(MethodInvocationExpression methodInvoke, bool queryable)
 {
     if (!this.TryProcessSingleParameterQuery(methodInvoke, true, queryable, out V_0))
     {
         return(false);
     }
     this.currentIdentifier = null;
     this.clauses.Add(new SelectClause(V_0, methodInvoke.get_InvocationInstructions()));
     return(true);
 }
 public ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
 {
     if (node.get_MethodExpression().get_CodeNodeType() == 20)
     {
         V_0 = node.get_MethodExpression();
         V_1 = V_0.get_Method();
         if (this.IsDelegateInvokeMethod(V_1))
         {
             V_2 = (ExpressionCollection)this.codeTransformer.Visit(node.get_Arguments());
             return(new DelegateInvokeExpression(V_0.get_Target(), V_2, V_1, node.get_InvocationInstructions()));
         }
     }
     return(null);
 }
 private bool TryProcessSelectManyMethod(MethodInvocationExpression methodInvoke, bool queryable)
 {
     V_0 = methodInvoke.get_MethodExpression().get_MethodDefinition();
     if (V_0.get_Parameters().get_Count() != 3)
     {
         return(false);
     }
     V_1 = this.GetFuncGenericInstance(V_0.get_Parameters().get_Item(1).get_ParameterType() as GenericInstanceType, queryable);
     if (V_1 == null || V_1.get_GenericArguments().get_Count() != 2)
     {
         return(false);
     }
     V_2 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(1), queryable);
     if (V_2 == null || V_2.get_Arguments().get_Count() != 1)
     {
         return(false);
     }
     this.ProcessCurrentIdentifier(methodInvoke.get_Arguments().get_Item(0), V_2.get_Parameters()[0].Resolve());
     stackVariable48    = new VariableReference[1];
     stackVariable48[0] = this.currentIdentifier;
     V_3 = this.ProcessReturnExpression(V_2, stackVariable48);
     if (V_3 == null)
     {
         return(false);
     }
     V_4 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(2), queryable);
     if (V_4 == null || V_4.get_Arguments().get_Count() != 2)
     {
         return(false);
     }
     V_5                = this.CreateNewIdentifier(V_4.get_Parameters()[1].get_Name(), V_4.get_Parameters()[1].get_ParameterType());
     stackVariable82    = new VariableReference[2];
     stackVariable82[0] = this.currentIdentifier;
     stackVariable82[1] = V_5;
     V_6                = this.ProcessReturnExpression(V_4, stackVariable82);
     if (V_6 == null)
     {
         return(false);
     }
     V_7 = this.GetIdentifierReference(V_5, ref V_3);
     this.clauses.Add(new FromClause(V_7, V_3, null));
     this.clauses.Add(new SelectClause(V_6, methodInvoke.get_InvocationInstructions()));
     this.currentIdentifier = null;
     return(true);
 }
 private bool TryProcessGroupByMethod(MethodInvocationExpression methodInvoke, bool queryable)
 {
     V_0 = methodInvoke.get_MethodExpression().get_MethodDefinition();
     if (V_0.get_Parameters().get_Count() > 3 || V_0.get_Parameters().get_Count() != V_0.get_GenericParameters().get_Count() || V_0.get_GenericParameters().get_Count() == 3 && String.op_Inequality(V_0.get_GenericParameters().get_Item(2).get_Name(), "TElement"))
     {
         return(false);
     }
     V_1 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(1), queryable);
     if (V_1 == null || V_1.get_Arguments().get_Count() != 1)
     {
         return(false);
     }
     this.ProcessCurrentIdentifier(methodInvoke.get_Arguments().get_Item(0), V_1.get_Parameters()[0].Resolve());
     stackVariable44    = new VariableReference[1];
     stackVariable44[0] = this.currentIdentifier;
     V_2 = this.ProcessReturnExpression(V_1, stackVariable44);
     if (V_2 == null)
     {
         return(false);
     }
     if (methodInvoke.get_Arguments().get_Count() != 3)
     {
         V_3 = new VariableReferenceExpression(this.currentIdentifier, null);
     }
     else
     {
         V_4 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(2), queryable);
         if (V_4 == null || V_4.get_Arguments().get_Count() != 1)
         {
             return(false);
         }
         stackVariable84    = new VariableReference[1];
         stackVariable84[0] = this.currentIdentifier;
         V_3 = this.ProcessReturnExpression(V_4, stackVariable84);
         if (V_3 == null)
         {
             return(false);
         }
     }
     this.clauses.Add(new GroupClause(V_3, V_2, methodInvoke.get_InvocationInstructions()));
     this.currentIdentifier = null;
     return(true);
 }
 private bool TryProcessThenByMethod(MethodInvocationExpression methodInvoke, bool ascending, bool queryable)
 {
     if (!this.TryProcessSingleParameterQuery(methodInvoke, false, queryable, out V_0))
     {
         return(false);
     }
     V_1 = this.clauses.get_Item(this.clauses.get_Count() - 1) as OrderByClause;
     if (V_1 == null)
     {
         return(false);
     }
     stackVariable17 = V_1.get_ExpressionToOrderDirectionMap();
     stackVariable18 = V_0;
     if (ascending)
     {
         stackVariable20 = 0;
     }
     else
     {
         stackVariable20 = 1;
     }
     stackVariable17.Add(stackVariable18, stackVariable20);
     this.clauses.set_Item(this.clauses.get_Count() - 1, V_1.CloneAndAttachInstructions(methodInvoke.get_InvocationInstructions()) as QueryClause);
     return(true);
 }
 private bool TryProcessOrderByMethod(MethodInvocationExpression methodInvoke, bool ascending, bool queryable)
 {
     if (!this.TryProcessSingleParameterQuery(methodInvoke, true, queryable, out V_0))
     {
         return(false);
     }
     V_1             = new OrderByClause(new PairList <Expression, OrderDirection>(), methodInvoke.get_InvocationInstructions());
     stackVariable11 = V_1.get_ExpressionToOrderDirectionMap();
     stackVariable12 = V_0;
     if (ascending)
     {
         stackVariable14 = 0;
     }
     else
     {
         stackVariable14 = 1;
     }
     stackVariable11.Add(stackVariable12, stackVariable14);
     this.clauses.Add(V_1);
     return(true);
 }
 private bool TryProcessJoinMethod(MethodInvocationExpression methodInvoke, bool isGroupJoin, bool queryable)
 {
     if (methodInvoke.get_MethodExpression().get_MethodDefinition().get_Parameters().get_Count() != 5)
     {
         return(false);
     }
     V_0 = (Expression)(new RebuildLinqQueriesStep.LinqQueriesRebuilder(this.methodContext)).Visit(methodInvoke.get_Arguments().get_Item(1).Clone());
     V_1 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(2), queryable);
     if (V_1 == null || V_1.get_Arguments().get_Count() != 1)
     {
         return(false);
     }
     this.ProcessCurrentIdentifier(methodInvoke.get_Arguments().get_Item(0), V_1.get_Parameters()[0].Resolve());
     stackVariable42    = new VariableReference[1];
     stackVariable42[0] = this.currentIdentifier;
     V_2 = this.ProcessReturnExpression(V_1, stackVariable42);
     if (V_2 == null)
     {
         return(false);
     }
     V_3 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(3), queryable);
     if (V_3 == null || V_3.get_Arguments().get_Count() != 1)
     {
         return(false);
     }
     V_4                = this.CreateNewIdentifier(V_3.get_Parameters()[0].get_Name(), V_3.get_Parameters()[0].get_ParameterType());
     stackVariable76    = new VariableReference[1];
     stackVariable76[0] = V_4;
     V_5                = this.ProcessReturnExpression(V_3, stackVariable76);
     if (V_5 == null)
     {
         return(false);
     }
     V_6 = this.GetLambdaExpression(methodInvoke.get_Arguments().get_Item(4), queryable);
     if (V_6 == null || V_6.get_Arguments().get_Count() != 2)
     {
         return(false);
     }
     V_7 = V_6.get_Parameters();
     if (isGroupJoin)
     {
         stackVariable106 = this.CreateNewIdentifier(V_7[1].get_Name(), V_7[1].get_ParameterType());
     }
     else
     {
         stackVariable106 = V_4;
     }
     V_8 = stackVariable106;
     stackVariable110    = new VariableReference[2];
     stackVariable110[0] = this.currentIdentifier;
     stackVariable110[1] = V_8;
     V_9 = this.ProcessReturnExpression(V_6, stackVariable110);
     if (V_9 == null)
     {
         return(false);
     }
     this.clauses.Add(new JoinClause(this.GetIdentifierReference(V_4, ref V_0), V_0, V_2, V_5, methodInvoke.get_InvocationInstructions()));
     if (isGroupJoin)
     {
         this.clauses.Add(new IntoClause(new VariableReferenceExpression(V_8, null), null));
     }
     this.clauses.Add(new SelectClause(V_9, null));
     this.currentIdentifier = null;
     return(true);
 }
 public ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
 {
     if (node.get_MethodExpression() == null)
     {
         return(null);
     }
     V_0 = node.get_MethodExpression();
     V_1 = V_0.get_Method();
     if (V_1.get_Name() == null)
     {
         return(null);
     }
     V_2 = this.GetEventMethodPrefix(V_1.get_Name());
     if (String.IsNullOrEmpty(V_2))
     {
         return(null);
     }
     if (V_1.get_Parameters().get_Count() != 1)
     {
         return(null);
     }
     V_3 = V_1.get_DeclaringType();
     V_4 = null;
     do
     {
         V_6 = new RebuildEventsStep.u003cu003ec__DisplayClass2_0();
         if (V_3 == null)
         {
             break;
         }
         V_7 = V_3.Resolve();
         if (V_7 == null)
         {
             break;
         }
         V_6.eventName = V_1.get_Name().Substring(V_2.get_Length());
         V_4           = V_7.get_Events().FirstOrDefault <EventDefinition>(new Func <EventDefinition, bool>(V_6.u003cVisitMethodInvocationExpressionu003eb__0));
         if (V_4 != null)
         {
             continue;
         }
         V_3 = V_7.get_BaseType();
     }while (V_3 != null && V_4 == null);
     if (V_4 == null)
     {
         return(null);
     }
     V_5 = new EventReferenceExpression(V_0.get_Target(), V_4, null);
     return(this.GetEventAssignExpression(V_5, node.get_Arguments().get_Item(0), V_2, node.get_InvocationInstructions()));
 }