示例#1
0
        /// <summary>
        /// Binds the specified <see cref="QueryNode"/>.
        /// </summary>
        /// <param name="queryNode">The <see cref="QueryNode"/> to bind.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="queryNode"/> is null.</exception>
        /// <exception cref="NotSupportedException">Thrown if the <see cref="QueryNodeKind"/> is not supported.</exception>
        protected void Bind(QueryNode queryNode)
        {
            if (queryNode is null)
            {
                throw new ArgumentNullException(nameof(queryNode));
            }

            switch (queryNode.Kind)
            {
            case QueryNodeKind.BinaryOperator:
                Bind((BinaryOperatorNode)queryNode);
                break;

            case QueryNodeKind.Constant:
                Bind((ConstantNode)queryNode);
                break;

            case QueryNodeKind.FunctionCall:
                Bind((FunctionCallNode)queryNode);
                break;

            case QueryNodeKind.PropertyAccess:
                Bind((PropertyAccessNode)queryNode);
                break;

            case QueryNodeKind.UnaryOperator:
                Bind((UnaryOperatorNode)queryNode);
                break;

            default:
                throw new NotSupportedException(ExceptionMessage.QueryNodeKindNotSupported(queryNode.Kind.ToString()));
            }
        }