private bool IsEnumerableContainsMethodCall(MethodCallExpression m, out Expression valuesExpression) { valuesExpression = null; if (m.Method.Name != "Contains") { return(false); } if (m.Method.DeclaringType == typeof(string)) { return(false); } if (m.Method.DeclaringType == typeof(List <string>)) { if (!MemberExpressionHelper.IsSpecificMemberExpression(m.Arguments[0], _entitiesType, _keyProperty.Name)) { return(false); } valuesExpression = m.Object; return(true); } if (m.Method.DeclaringType == typeof(Enumerable) || m.Method.DeclaringType == typeof(Queryable)) { if (!MemberExpressionHelper.IsSpecificMemberExpression(m.Arguments[1], _entitiesType, _keyProperty.Name)) { return(false); } valuesExpression = m.Arguments[0]; return(true); } return(false); }
protected override Expression VisitBinary(BinaryExpression be) { _expressionUsesBinaryExpressions = true; if (be.NodeType == ExpressionType.Equal) { if (MemberExpressionHelper.IsMemberEqualsValueExpression(be, _entitiesType, _keyProperty.Name)) { Identifiers.Add(MemberExpressionHelper.GetValueFromEqualsExpression(be, _entitiesType, _keyProperty.Name)); // return be; return(base.VisitBinary(be)); } else { return(base.VisitBinary(be)); } } else { _thereIsNotOnlyEqualsExpressions = true; return(base.VisitBinary(be)); } }