Пример #1
0
        public void query_over()
        {
            new QueryOver <User>(() =>
            {
                var db = GetConnection();    //any new connection resets table name
                db.Open();
                return(db);
            }, _table).Select(d => d.FirstName, d => d.FirstName == "John").GetValue().Should()
            .Be("John");

            var u = new QueryOver <User>(() =>
            {
                var db = GetConnection();
                db.Open();
                return(db);
            }, _table).SelectAllColumns(d => d.FirstName == "John").GetFirstRow();

            u.FirstName.Should().Be("John");


            var count = new QueryOver <User>(() =>
            {
                var db = GetConnection();
                db.Open();
                return(db);
            }, _table).Build(q => q.Where(d => d.Id > 0).Select(d => d.Count())).GetValue();

            count.Should().Be(_inserted.Length);
        }