internal override Expression VisitBinary(BinaryExpression b) { if (b.NodeType == ExpressionType.AndAlso) // Boolean And with short-circuit { VisitCombination(b, (qh) => { /* noop -- AND is the default combinator */ }); } else if (b.NodeType == ExpressionType.OrElse) // Boolean Or with short-circuit { VisitCombination(b, qh => NativeQuery.or(qh)); } else { var leftMember = b.Left as MemberExpression; if (leftMember == null) { throw new NotSupportedException( $"The lhs of the binary operator '{b.NodeType}' should be a member expression"); } var leftName = leftMember.Member.Name; var rightValue = ExtractConstantValue(b.Right); if (rightValue == null) { throw new NotSupportedException($"The rhs of the binary operator '{b.NodeType}' should be a constant or closure variable expression"); } switch (b.NodeType) { case ExpressionType.Equal: AddQueryEqual(_coreQueryHandle, leftName, rightValue); break; case ExpressionType.NotEqual: AddQueryNotEqual(_coreQueryHandle, leftName, rightValue); break; case ExpressionType.LessThan: AddQueryLessThan(_coreQueryHandle, leftName, rightValue); break; case ExpressionType.LessThanOrEqual: AddQueryLessThanOrEqual(_coreQueryHandle, leftName, rightValue); break; case ExpressionType.GreaterThan: AddQueryGreaterThan(_coreQueryHandle, leftName, rightValue); break; case ExpressionType.GreaterThanOrEqual: AddQueryGreaterThanOrEqual(_coreQueryHandle, leftName, rightValue); break; default: throw new NotSupportedException(string.Format("The binary operator '{0}' is not supported", b.NodeType)); } } return(b); }