예제 #1
0
        /// <summary>
        /// Describe the query to perform using a query descriptor lambda
        /// </summary>
        public SearchDescriptor <T> Query(Func <QueryDescriptor <T>, BaseQuery> query)
        {
            query.ThrowIfNull("query");
            var q = new QueryDescriptor <T>();

            if (this._Strict)
            {
                q.Strict(true);
            }
            var bq = query(q);

            if (this._Strict && bq.IsConditionless)
            {
                throw new DslException("Query resulted in a conditionless query:\n{0}".F(JsonConvert.SerializeObject(bq, Formatting.Indented)));
            }

            else if (bq.IsConditionless)
            {
                return(this);
            }
            this._Query = bq;
            return(this);
        }