public void AddClause(string text, ChainOperator chainOp) { if (text == null) { throw new ArgumentNullException("text"); } if (text.Length == 0) { throw new ArgumentException("Clause cannot be empty", "text"); } if (string.IsNullOrEmpty(this.Text)) { this.Text = text; } else { switch (chainOp) { case ChainOperator.And: this.Text = MoveSettingsToTheEnd(string.Format("+({0}) +({1})", Text, text)).Trim(); break; case ChainOperator.Or: this.Text = MoveSettingsToTheEnd(string.Format("({0}) {1}", Text, text)); break; } } }
public static string AddClause(string originalText, string addition, ChainOperator chainOp) { if (addition == null) { throw new ArgumentNullException("addition"); } if (addition.Length == 0) { throw new ArgumentException("Clause cannot be empty", "addition"); } if (string.IsNullOrEmpty(originalText)) { return(addition); } var queryText = string.Empty; switch (chainOp) { case ChainOperator.And: queryText = MoveSettingsToTheEnd(string.Format("+({0}) +({1})", originalText, addition)).Trim(); break; case ChainOperator.Or: queryText = MoveSettingsToTheEnd(string.Format("({0}) {1}", originalText, addition)); break; } return(queryText); }
private void AddClausePrivate(string text, ChainOperator chainOp) { if (text == null) { throw new ArgumentNullException("text"); } if (text.Length == 0) { throw new ArgumentException("Clause cannot be empty", "text"); } if (string.IsNullOrEmpty(this.Text)) { this.Text = text; } else { // we can modify the _text variable here directly because it was already fixed at init time switch (chainOp) { case ChainOperator.And: this._text = MoveSettingsToTheEnd(string.Format("+({0}) +({1})", Text, text)).Trim(); break; case ChainOperator.Or: this._text = MoveSettingsToTheEnd(string.Format("({0}) {1}", Text, text)); break; } } }
public ExpressionList(ChainOperator operatorType, params Expression[] expressions) : this(operatorType) { foreach (Expression exp in expressions) if (exp == null) throw new ArgumentOutOfRangeException("expressions", "Expression parameter cannot be null"); foreach (var expression in expressions) Add(expression); }
public ExpressionList(ChainOperator operatorType, Expression expression) : this(operatorType) { if (expression == null) { throw new ArgumentNullException("expression"); } Add(expression); }
public ExpressionList(ChainOperator operatorType, Expression exp0, Expression exp1) : this(operatorType) { if (exp0 == null) throw new ArgumentNullException("exp0"); if (exp1 == null) throw new ArgumentNullException("exp1"); Add(exp0); Add(exp1); }
private static Expression ParseExpressionList(XmlNode node, XmlNamespaceManager nsmgr, SchemaRoot schema) { ChainOperator op = (ChainOperator)Enum.Parse(typeof(ChainOperator), node.LocalName); ExpressionList exprList = new ExpressionList(op); foreach (XmlNode subNode in node.SelectNodes("x:*", nsmgr)) { exprList.Add(ParseExpression(subNode, nsmgr, schema)); } return(exprList); }
public void AddClause(string text, ChainOperator chainOp, params object[] parameters) { var isSafe = this.IsSafe && IsSafeQuery(text); if (parameters != null && parameters.Length > 0) { text = SubstituteParameters(text, parameters); } this.IsSafe = isSafe; AddClausePrivate(text, chainOp); }
public ExpressionList(ChainOperator operatorType, Expression exp0, Expression exp1) : this(operatorType) { if (exp0 == null) { throw new ArgumentNullException("exp0"); } if (exp1 == null) { throw new ArgumentNullException("exp1"); } Add(exp0); Add(exp1); }
public ExpressionList(ChainOperator operatorType, params Expression[] expressions) : this(operatorType) { foreach (Expression exp in expressions) { if (exp == null) { throw new ArgumentOutOfRangeException("expressions", "Expression parameter cannot be null"); } } foreach (var expression in expressions) { Add(expression); } }
public ChainSelector(Selector prevSelector, Selector nextSelector, ChainOperator chainOperator) { if (prevSelector == null) { throw new ArgumentNullException(nameof(prevSelector)); } if (nextSelector == null) { throw new ArgumentNullException(nameof(nextSelector)); } Priority = Math.Max(prevSelector.Priority, nextSelector.Priority); _prevSelector = prevSelector; _nextSelector = nextSelector; _chainOperator = chainOperator; }
public void AddClause(Expression expression, ChainOperator chainOp) { if (expression == null) { throw new ArgumentNullException("expression"); } ExpressionList finalExpList; var origExpList = expression as ExpressionList; if (origExpList != null) { finalExpList = origExpList; } else { finalExpList = new ExpressionList(chainOp); finalExpList.Add(expression); } this.Text = AddFilterToNodeQuery(Text, finalExpList.ToXml()); }
public void AddClause(string text, ChainOperator chainOp) { if (text == null) throw new ArgumentNullException("text"); if (text.Length == 0) throw new ArgumentException("Clause cannot be empty", "text"); if (string.IsNullOrEmpty(this.Text)) this.Text = text; else { switch (chainOp) { case ChainOperator.And: this.Text = MoveSettingsToTheEnd(string.Format("+({0}) +({1})", Text, text)).Trim(); break; case ChainOperator.Or: this.Text = MoveSettingsToTheEnd(string.Format("({0}) {1}", Text, text)); break; } } }
public static string AddClause(string originalText, string addition, ChainOperator chainOp) { if (addition == null) throw new ArgumentNullException("addition"); if (addition.Length == 0) throw new ArgumentException("Clause cannot be empty", "addition"); if (string.IsNullOrEmpty(originalText)) return addition; var queryText = string.Empty; switch (chainOp) { case ChainOperator.And: queryText = MoveSettingsToTheEnd(string.Format("+({0}) +({1})", originalText, addition)).Trim(); break; case ChainOperator.Or: queryText = MoveSettingsToTheEnd(string.Format("({0}) {1}", originalText, addition)); break; } return queryText; }
public void AddClause(Expression expression, ChainOperator chainOp) { if (expression == null) throw new ArgumentNullException("expression"); ExpressionList finalExpList; var origExpList = expression as ExpressionList; if (origExpList != null) { finalExpList = origExpList; } else { finalExpList = new ExpressionList(chainOp); finalExpList.Add(expression); } this.Text = AddFilterToNodeQuery(Text, finalExpList.ToXml()); }
public ExpressionList(ChainOperator operatorType) { _operatorType = operatorType; _expressions = new List <Expression>(); }
public ExpressionList(ChainOperator operatorType) { _operatorType = operatorType; _expressions = new List<Expression>(); }
public NodeQuery(ChainOperator operatorType, params Expression[] expressions) : base(operatorType, expressions) { Initialize(); }
public ExpressionList(ChainOperator operatorType, Expression expression) : this(operatorType) { if (expression == null) throw new ArgumentNullException("expression"); Add(expression); }
public void AddClause(string text, ChainOperator chainOp) { AddClause(text, chainOp, null); }