public void CompositeOperand()
        {
            string sqlCondition = "Where Name = TomDeng  AND Age = 29  AND (Weight BETWEEN 100 AND 180  AND Salary < 20w )";

            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.Equal("Name", "TomDeng"))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Equal("Age", 29))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Bracket(Bracket.Left))
                              .Append(Restrictions.Between("Weight", 100, 180))
                              .Append(Restrictions.And)
                              .Append(Restrictions.LessThan("Salary", "20w"))
                              .Append(Restrictions.Bracket(Bracket.Rgiht));

            Assert.That(operand.ToString(), Is.EqualTo(sqlCondition));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.Equal("Name", "TomDeng"))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Equal("Age", 29))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Bracket(Bracket.Left))
                              .Append(Restrictions.Between("Weight", 100, 180))
                              .Append(Restrictions.And)
                              .Append(Restrictions.LessThan("Salary", "20w"))
                              .Append(Restrictions.Bracket(Bracket.Rgiht));

            System.Console.WriteLine(operand);
            System.Console.WriteLine("Finished");
            System.Console.Read();
        }