private bool TryMatchLinqQuery(MethodInvocationExpression methodInvocation, out LinqQueryExpression linqQuery) { V_0 = new Stack <MethodInvocationExpression>(); V_1 = methodInvocation; V_2 = V_1.get_MethodExpression().get_MethodDefinition().IsQueryableMethod(); while (V_1 != null && V_1.get_MethodExpression().get_MethodDefinition().IsQueryMethod() && V_2 == V_1.get_MethodExpression().get_MethodDefinition().IsQueryableMethod()) { V_0.Push(V_1); V_1 = V_1.get_Arguments().get_Item(0) as MethodInvocationExpression; } if (V_0.get_Count() == 0) { linqQuery = null; return(false); } V_3 = V_0.Peek(); V_3.get_Arguments().set_Item(0, (Expression)this.Visit(V_3.get_Arguments().get_Item(0))); linqQuery = this.ProcessExtensionMethodChain(V_0, methodInvocation, V_2); return(linqQuery != null); }
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); }