public void OrderByInjection()
 {
     // Inject the OrderBy to an existing "from clause"
     OrderBy o = new OrderBy().Add("f.Name").Add("f.Id", true);
     From frm = new From("Foo");
     frm.SetOrderBy(o);
     Assert.AreEqual("from Foo order by f.Name, f.Id desc", frm.Clause);
 }
        public DetachedDynQuery(From from)
        {
            if (from == null)
            {
                throw new ArgumentNullException("from");
            }

            this.from = from;
        }
        public DetachedDynQuery(Select select)
        {
            if (select == null)
            {
                throw new ArgumentNullException("select");
            }

            this.select = select;
            from = select.From();
        }
Example #4
0
 public From FromWhereClause()
 {
     From result = new From(partialClause);
     if (where != null)
     {
         result.SetWhere(where.Clone());
     }
     return result;
 }
 public Select From(string partialClause)
 {
     if (from != null)
     {
         throw new NotSupportedException(
             string.Format("Can't override the 'from' clause; original 'from':{0}", from.Expression));
     }
     from = new From(partialClause);
     return this;
 }
        public void SetFrom(From fromClause)
        {
            if (fromClause == null)
            {
                throw new ArgumentNullException("fromClause");
            }

            from = fromClause;
        }
 public void WhereInjection()
 {
     // Create a where clause away of the from clause
     Where w = (new Where("f.Name like :p1")).And("length(f.Name)>2").Or("f.Name like 'N%'");
     From frm = new From("Foo f");
     frm.SetWhere(w);
     Assert.AreEqual("from Foo f where ((f.Name like :p1) and (length(f.Name)>2) or (f.Name like 'N%'))",
                     frm.Clause);
 }
 public void SimpleQuery()
 {
     From frm = new From("Foo f");
     frm.Where("f.Name like :p1").And("length(f.Name)>2").Or("f.Name like 'N%'");
     Assert.AreEqual("from Foo f where ((f.Name like :p1) and (length(f.Name)>2) or (f.Name like 'N%'))",
                     frm.Clause);
 }