Example #1
0
        /// <summary>
        /// The validate API allows a user to validate a potentially expensive query without executing it.
        /// </summary>
        public IValidateResponse Validate <T>(Func <ValidateQueryPathDescriptor <T>, BaseQuery> querySelector) where T : class
        {
            var descriptor  = new ValidateQueryPathDescriptor <T>();
            var bq          = querySelector(descriptor);
            var stringQuery = this.Serialize(descriptor);
            var path        = this.PathResolver.GetPathForTyped(descriptor, "_validate/query");

            if (descriptor._QueryStringQuery.IsNullOrEmpty())
            {
                return(this._Validate(path, stringQuery));
            }
            return(this._ValidateQueryString(path));
        }
Example #2
0
        /// <summary>
        /// The validate API allows a user to validate a potentially expensive query without executing it.
        /// </summary>
        public IValidateResponse Validate(Action <ValidateQueryPathDescriptor> querySelector)
        {
            var descriptor = new ValidateQueryPathDescriptor();

            querySelector(descriptor);
            var stringQuery = this.Serialize(descriptor);
            var path        = this.PathResolver.GetPathForTyped(descriptor, "_validate/query");

            if (descriptor._QueryStringQuery.IsNullOrEmpty())
            {
                return(this._Validate(path, stringQuery));
            }
            return(this._ValidateQueryString(path));
        }