示例#1
0
        /// <summary>
        /// Create a new QueryCategory in this QueryConfiguration.
        /// </summary>
        public QueryCategory CreateQueryCategory(string name, string value)
        {
            CheckCategory(name);
            var category = new QueryCategory(name, value);

            QueryCategoriesCollection.Add(category);
            return(category);
        }
示例#2
0
        /// <summary>
        /// Create a new QueryCategory or update the category if it already exits in this QueryConfiguration.
        /// </summary>
        public QueryCategory UpdaterOrCreateQueryCategory(string name, string value)
        {
            var category =
                QueryCategoriesCollection.SingleOrDefault(
                    cat => cat.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));

            if (category == null)
            {
                category = new QueryCategory(name, value);
                QueryCategoriesCollection.Add(category);
            }
            else
            {
                category.Value = value;
            }
            return(category);
        }