Exemplo n.º 1
0
        public SelectPaging(BracketedName alias, Select innerSelect, IValueProvider skip)
        {
            innerSelect.Columns.AddRowNumber(innerSelect.OrderBy);
            innerSelect.OrderBy = null;

            _skip = skip;
            _innerSelect = innerSelect;
            _alias = alias;
        }
Exemplo n.º 2
0
        public WhereConverter(Select select, QueryContext context)
        {
            if (select == null)
                throw new ArgumentNullException("select");

            if (context == null)
                throw new ArgumentNullException("context");

            _select = select;
            _context = context;
        }
Exemplo n.º 3
0
        public void CanRenderSelect()
        {
            var writer = new SqlWriter();
            var convention = new DefaultConvention();
            var builder = new EntityMapBuilder<Student>(convention);

            var map = ((EntityMapBuilder<Student>) builder
                                                       .Key(_ => _.ID, "Student_id")).Build();

            var selectEntity = new Select(map, "t0");

            selectEntity.Render(writer);
            var result = writer.GetResult();

            AssertHelper.AreEqualWithNoSpaces(
            @"SELECT [t0].[Student_id], [t0].[Name]
            FROM [dbo].[Student] AS [t0] (NOLOCK)", result);
        }
Exemplo n.º 4
0
 public From(Select select)
 {
     _select = select;
 }
Exemplo n.º 5
0
        private ISqlNode VisitRoot(ISqlNode parent, Expression expr)
        {
            var select = new Select(_context);

            return select;
        }
Exemplo n.º 6
0
        static string GetWhere(Expression<Func<Student, bool>> expr)
        {
            var convention = new DefaultConvention();
            var builder = new EntityMapBuilder<Student>(convention);

            var map = ((EntityMapBuilder<Student>)builder
                        .Key(_ => _.ID, "Student_id"))
                        .Build();

            var context = new QueryContext(new[]{map}, "");
            var selectEntity = new Select(map, "t0");
            var whereParser = new WhereConverter(selectEntity, context);

            var node = whereParser.Visit(expr);
            node.Render(context.Writer);
            var result = context.Writer.GetResult();

            return result;
        }