/// <summary> Adds new criteria group to last node in SigleQuery </summary> /// <param name="singleQuery"></param> /// <param name="appender"></param> /// <param name="actions"></param> /// <returns> Newly created Criteria Group QueryNode </returns> public static QueryNode AddCriteriaGroup(this SingleQuery singleQuery, CriteriaAppendType appender, params Action <QueryNode>[] actions) { var newNode = singleQuery.NodesList.Last.Value.AddCriteriaGroup(appender, actions); return(newNode); }
private void AndOrVisitor(JProperty property, CriteriaAppendType appendType) { var criterias = property.Value as JArray; if (criterias == null) { throw new Exception($"{property.Name} is not JArray"); } var criteriaGroup = CurrentQueryNode.AddCriteriaGroup(appendType); processingObjectTypeStack.Push(ProcessingObjectType.ConditionGroup); queryNodesStack.Push(criteriaGroup); foreach (var criteria in criterias) { var criteriaObject = criteria as JObject; if (criteriaObject == null) { throw new Exception($"{"Criteria"} is not JObject"); } ProcessJObject(criteriaObject); } processingObjectTypeStack.Pop(); queryNodesStack.Pop(); }
public static LinkedListNode <QueryNode> AddCriteria(this LinkedListNode <QueryNode> node, CriteriaAppendType appender, SingleQuery subjectQuery, CriteriaComparator comparator, object value, params Action <QueryNode>[] actions) { node.Value.AddCriteria(subjectQuery, comparator, value, actions); return(node); }
public static SingleQuery AddCriteria(this SingleQuery singleQuery, CriteriaAppendType appender, SingleQuery subjectQuery, CriteriaComparator comparator, object value, params Action <QueryNode>[] actions) { singleQuery.NodesList.Last.AddCriteria(appender, subjectQuery, comparator, value, actions); return(singleQuery); }
/// <summary> Adds Criteria to specified node in SingleQuery </summary> /// <param name="node"></param> /// <param name="appender"></param> /// <param name="name"></param> /// <param name="comparator"></param> /// <param name="value"></param> /// <param name="actions"></param> /// <returns></returns> public static LinkedListNode <QueryNode> AddCriteria(this LinkedListNode <QueryNode> node, CriteriaAppendType appender, string name, CriteriaComparator comparator, object value, params Action <QueryNode>[] actions) { var criteriaSubjectQuery = SingleQuery.CreateQuery.AddProperty(name); node.AddCriteria(appender, criteriaSubjectQuery, comparator, value, actions); return(node); }
/// <summary> Adds new criteria group to specified QueryNode </summary> /// <param name="node"></param> /// <param name="appender"></param> /// <param name="actions"></param> /// <returns> Newly created Criteria Group QueryNode </returns> public static QueryNode AddCriteriaGroup(this QueryNode node, CriteriaAppendType appender, params Action <QueryNode>[] actions) { var newNode = new QueryNode { Type = QueryNodeType.CriteriaGroup, Appender = appender, }; actions?.ForEach(x => x.Invoke(newNode)); node.Criterias.Add(newNode); return(newNode); }
/// <summary> Get query language token id by CriteriaAppendType </summary> /// <param name="type"></param> /// <returns></returns> public static int GetToken(CriteriaAppendType type) { return(CriteriaAppendTypeToToken[type]); }