Beispiel #1
0
        /// <summary>
        /// Add a component clause to the query.
        /// </summary>
        /// <param name="component"></param>
        /// <param name="clause"></param>
        /// <returns></returns>
        public Q Add(string component, AbstractClause clause)
        {
            clause.Component = component;
            Clauses.Add(clause);

            return((Q)this);
        }
        /// <summary>
        /// Add a component clause to the query.
        /// </summary>
        /// <param name="component"></param>
        /// <param name="clause"></param>
        /// <param name="engineCode"></param>
        /// <returns></returns>
        public Q AddComponent(string component, AbstractClause clause, string engineCode = null)
        {
            if (engineCode == null)
            {
                engineCode = EngineScope;
            }

            clause.Engine    = engineCode;
            clause.Component = component;
            Clauses.Add(clause);

            return((Q)this);
        }
Beispiel #3
0
        /// <summary>
        /// If the query already contains a clause for the given component
        /// and engine, replace it with the specified clause. Otherwise, just
        /// add the clause.
        /// </summary>
        /// <param name="component"></param>
        /// <param name="clause"></param>
        /// <param name="engineCode"></param>
        /// <returns></returns>
        public Q AddOrReplaceComponent(string component, AbstractClause clause, string engineCode = null)
        {
            engineCode = engineCode ?? EngineScope;

            var current = GetComponents(component).SingleOrDefault(c => c.Engine == engineCode);

            if (current != null)
            {
                Clauses.Remove(current);
            }

            return(AddComponent(component, clause, engineCode));
        }