private static bool IsValidListContainsCall([NotNull] MethodCallExpression node) { return(MethodUtils.IsOperator(node.Method, MethodUtils.ListContains) && node.Object != null && node.Object.NodeType == ExpressionType.Constant && node.Arguments[0].NodeType == ExpressionType.MemberAccess); }
private WhereModel TranslateCall([NotNull] MethodCallExpression callNode) { if (MethodUtils.IsOperator(callNode.Method, MethodUtils.EContains)) { return(new ComparisonModel(ComparisonOperator.ContainsOrIncludes, CamlProcessorUtils.GetFieldRef(callNode.Arguments[0]), GetValue(callNode.Arguments[1]))); } if (MethodUtils.IsOperator(callNode.Method, MethodUtils.ListContains)) { return(new ComparisonModel(ComparisonOperator.ContainsOrIncludes, CamlProcessorUtils.GetFieldRef(callNode.Object), GetValue(callNode.Arguments[0]))); } if (callNode.Method == MethodUtils.StrContains) { return(TranslateStrContains(callNode)); } if (callNode.Method == MethodUtils.StrStartsWith) { return(TranslateStrStartsWith(callNode)); } if (callNode.Method.Name == "Contains" && callNode.Object != null && (callNode.Object.Type.IsArray || callNode.Object.Type.IsIEnumerable()) && callNode.Arguments.Count == 1) { return(new ComparisonModel(ComparisonOperator.ContainsOrIncludes, CamlProcessorUtils.GetFieldRef(callNode.Object), GetValue(callNode.Arguments[0]))); } throw Error.SubqueryNotSupported(callNode); }
private static bool IsValidEnumerableContainsCall([NotNull] MethodCallExpression node) { return(MethodUtils.IsOperator(node.Method, MethodUtils.EContains) && node.Arguments[0].NodeType == ExpressionType.Constant && node.Arguments[1].NodeType == ExpressionType.MemberAccess); }
private static bool IsValidObjectInCall([NotNull] MethodCallExpression node) { return(MethodUtils.IsOperator(node.Method, MethodUtils.ObjIn) && node.Arguments[0].NodeType == ExpressionType.MemberAccess && node.Arguments[1].NodeType == ExpressionType.Constant); }