Ejemplo n.º 1
0
        private void build(DbFilterNode filterNode)
        {
            DbFilterGroup filterGroup = filterNode as DbFilterGroup;

            if (filterGroup != null)
            {
                string expression = (filterNode is DbAndFilterGroup) ? " AND " : " OR ";

                sb.Append('(');
                int count = filterGroup.Nodes.Count;
                for (int i = 0; i < count; i++)
                {
                    var node = filterGroup.Nodes[i];
                    build(node);

                    if (i < count - 1)
                    {
                        sb.Append(expression);
                    }
                }
                sb.Append(')');
            }
            else
            {
                DbFilterExpression exp = (DbFilterExpression)filterNode;
                sb.Append(exp.ToString(accessor, args.Count));
                exp.AddParameters(args);
            }

            /*sb.Append(filterNode[0].ToString(gateway.Accessor, 0));
             * filterNode[0].AddParameters(args);
             *
             * for (int i = 1; i < count; i++)
             * {
             *  sb.Append(" AND ");
             *  sb.Append(filterNode[i].ToString(gateway.Accessor, i));
             *  filterNode[i].AddParameters(args);
             * }*/
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds Expression
 /// </summary>
 /// <param name="expression"></param>
 /// <returns></returns>
 public DbQuery Add(DbFilterNode expression)
 {
     FilterGroup.Add(expression);
     return(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the specified node.
 /// </summary>
 /// <param name="node">The node.</param>
 public void Add(DbFilterNode node)
 {
     Nodes.Add(node);
 }