public static bool Validate(QuerySpecification querySpecification, bool throwIfHasError = false)
        {
            var validators = new QuerySpecificationValidator[]
            {
                new ExpressionNameTypeValidator(querySpecification)
            };

            return Validate(throwIfHasError, validators);
        }
        public static bool Validate(QuerySpecification querySpecification, bool throwIfHasError = false)
        {
            var validators = new QuerySpecificationValidator[]
            {
                new ExpressionNameTypeValidator(querySpecification)
            };

            return(Validate(throwIfHasError, validators));
        }
        /// <summary>
        /// 将给定的查询规约编译成另外一种形式。
        /// </summary>
        /// <param name="querySpecification">将被编译的查询规约。</param>
        /// <returns>查询规约的另外一种形式。</returns>
        public T Compile(QuerySpecification querySpecification)
        {
            try
            {
                QuerySpecificationValidator.Validate(querySpecification, true);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException(
                          "Can't compile the given query specificaiton as the validation was failed. See InnerException for details.",
                          ex);
            }

            return(this.PerformCompile(querySpecification));
        }