コード例 #1
0
 public void SetUp()
 {
     _generator = new UniqueIdentifierGenerator();
     _stage     = new DefaultSqlPreparationStage(
         CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);
     _handler = new AverageResultOperatorHandler();
     _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
コード例 #2
0
        public override void SetUp()
        {
            base.SetUp();

            _stage               = CreateDefaultSqlPreparationStage();
            _handler             = new OfTypeResultOperatorHandler();
            _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatementWithCook());
            _context             = SqlStatementModelObjectMother.CreateSqlPreparationContext();
        }
 public void SetUp()
 {
     _stageMock = MockRepository.GenerateStrictMock <ISqlPreparationStage>();
     _generator = new UniqueIdentifierGenerator();
     _context   = SqlStatementModelObjectMother.CreateSqlPreparationContext();
     _methodCallTransformerProvider = CompoundMethodCallTransformerProvider.CreateDefault();
     _visitor = new TestableSqlPreparationFromExpressionVisitor(
         _generator, _stageMock, _methodCallTransformerProvider, _context, info => new SqlTable(info, JoinSemantics.Inner));
 }
コード例 #4
0
 public void SetUp()
 {
     _stageMock           = MockRepository.GenerateMock <ISqlPreparationStage> ();
     _generator           = new UniqueIdentifierGenerator();
     _handler             = new CastResultOperatorHandler();
     _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatement())
     {
         DataInfo = new StreamedSequenceInfo(typeof(Cook[]), Expression.Constant(new Cook()))
     };
     _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
コード例 #5
0
 public void SetUp()
 {
     _handler          = new TestableResultOperatorHandler();
     _resultOperator   = new TestChoiceResultOperator(false);
     _statementBuilder = new SqlStatementBuilder();
     _statementBuilder.SelectProjection = Expression.Constant("select");
     _statementBuilder.DataInfo         = new StreamedSequenceInfo(typeof(Cook[]), Expression.Constant(new Cook()));
     _generator = new UniqueIdentifierGenerator();
     _stageMock = MockRepository.GenerateMock <ISqlPreparationStage>();
     _context   = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
コード例 #6
0
 public void SetUp()
 {
     _generator           = new UniqueIdentifierGenerator();
     _stage               = new DefaultSqlPreparationStage(new CompoundMethodCallTransformerProvider(), new ResultOperatorHandlerRegistry(), _generator);
     _handler             = new SumResultOperatorHandler();
     _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatement())
     {
         DataInfo = new StreamedSequenceInfo(typeof(int[]), Expression.Constant(5))
     };
     _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
コード例 #7
0
        public void SetUp()
        {
            _stageMock          = MockRepository.GenerateMock <ISqlPreparationStage>();
            _context            = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _cookMainFromClause = ExpressionHelper.CreateMainFromClause <Cook>();
            _cookQuerySourceReferenceExpression = new QuerySourceReferenceExpression(_cookMainFromClause);
            var source = new UnresolvedTableInfo(_cookMainFromClause.ItemType);

            _sqlTable = new SqlTable(source, JoinSemantics.Inner);
            _context.AddExpressionMapping(new QuerySourceReferenceExpression(_cookMainFromClause), new SqlTableReferenceExpression(_sqlTable));
            _methodCallTransformerProvider = CompoundMethodCallTransformerProvider.CreateDefault();
        }
コード例 #8
0
        public override void SetUp()
        {
            base.SetUp();

            _stage               = CreateDefaultSqlPreparationStage();
            _handler             = new TakeResultOperatorHandler();
            _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatement())
            {
                DataInfo = new StreamedSequenceInfo(typeof(Cook[]), Expression.Constant(new Cook()))
            };
            _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
        }
コード例 #9
0
        public void SetUp()
        {
            _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _source  = ExpressionHelper.CreateMainFromClause <Cook>();
            var source = new UnresolvedTableInfo(typeof(int));

            _sqlTable            = new SqlTable(source, JoinSemantics.Inner);
            _parentContext       = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _parentSource        = ExpressionHelper.CreateMainFromClause <Cook>();
            _parentSqlTable      = new SqlTable(new UnresolvedTableInfo(typeof(int)), JoinSemantics.Inner);
            _sqlStatementBuilder = new SqlStatementBuilder();
            _contextWithParent   = new SqlPreparationContext(_parentContext, _sqlStatementBuilder);
        }
コード例 #10
0
        public override void SetUp()
        {
            base.SetUp();

            _stage               = CreateDefaultSqlPreparationStage();
            _handler             = new TestableAggregationResultOperatorHandler();
            _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatement())
            {
                DataInfo         = new StreamedSequenceInfo(typeof(int[]), Expression.Constant(5)),
                SelectProjection = new NamedExpression(null, Expression.Constant(0))
            };
            _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
        }
        public void SetUp()
        {
            _stageMock = MockRepository.GenerateStrictMock <ISqlPreparationStage>();
            _generator = new UniqueIdentifierGenerator();
            _context   = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _methodCallTransformerProvider = CompoundMethodCallTransformerProvider.CreateDefault();

            _someOrderingExtractionPolicy = Some.Item(
                OrderingExtractionPolicy.ExtractOrderingsIntoProjection,
                OrderingExtractionPolicy.DoNotExtractOrderings);

            _tableGenerator = info => new SqlTable(info, JoinSemantics.Inner);
        }
コード例 #12
0
        public void SetUp()
        {
            _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();

            var querySource = ExpressionHelper.CreateMainFromClause <Cook>();

            _sqlTable = new SqlTable(new UnresolvedTableInfo(typeof(Cook)), JoinSemantics.Inner);

            _context.AddExpressionMapping(new QuerySourceReferenceExpression(querySource), new SqlTableReferenceExpression(_sqlTable));

            _querySourceReferenceExpression = new QuerySourceReferenceExpression(querySource);

            _stage = new DefaultSqlPreparationStage(
                CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), new UniqueIdentifierGenerator());
        }
        public override void SetUp()
        {
            base.SetUp();

            _stageMock = MockRepository.GenerateMock <ISqlPreparationStage> ();
            _handler   = new UnionResultOperatorHandler();

            var selectProjection = ExpressionHelper.CreateExpression(typeof(int));

            _sqlStatementBuilder = new SqlStatementBuilder
            {
                DataInfo         = new StreamedSequenceInfo(typeof(int[]), selectProjection),
                SelectProjection = selectProjection
            };
            _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
        }
コード例 #14
0
        public void SetUp()
        {
            _generator    = new UniqueIdentifierGenerator();
            _context      = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _defaultStage = new DefaultSqlPreparationStage(
                CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);

            _mainFromClause = ExpressionHelper.CreateMainFromClause <Cook>();
            _selectClause   = ExpressionHelper.CreateSelectClause(_mainFromClause);
            _orderByClause  = ExpressionHelper.CreateOrderByClause();
            _queryModel     = new QueryModel(_mainFromClause, _selectClause);

            _stageMock          = MockRepository.GenerateStrictMock <ISqlPreparationStage>();
            _visitor            = new TestableSqlPreparationQueryModelVisitor(_context, _stageMock);
            _visitorPartialMock = MockRepository.GeneratePartialMock <TestableSqlPreparationQueryModelVisitor> (_context, _stageMock);
        }
        public void SetUp()
        {
            _stageMock = MockRepository.GenerateStrictMock <ISqlPreparationStage>();
            _context   = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            _generator = new UniqueIdentifierGenerator();
            _factory   = new SqlPreparationSubStatementTableFactory(_stageMock, _context, _generator);

            var builderForStatementWithOrderings = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatementWithCook())
            {
                Orderings =
                {
                    new Ordering(Expression.Constant("order1"), OrderingDirection.Desc),
                    new Ordering(Expression.Constant("order2"), OrderingDirection.Asc),
                }
            };

            _statementWithOrderings = builderForStatementWithOrderings.GetSqlStatement();
        }
コード例 #16
0
        public void SetUp()
        {
            _stageMock = MockRepository.GenerateMock <ISqlPreparationStage> ();
            _generator = new UniqueIdentifierGenerator();
            _context   = SqlStatementModelObjectMother.CreateSqlPreparationContext();

            _handler = new SkipResultOperatorHandler();

            _sqlTable         = new SqlTable(new UnresolvedTableInfo(typeof(Cook)), JoinSemantics.Inner);
            _selectProjection = new SqlTableReferenceExpression(_sqlTable);

            _ordering            = new Ordering(Expression.Constant(7), OrderingDirection.Asc);
            _sqlStatementBuilder = new SqlStatementBuilder
            {
                SelectProjection = _selectProjection,
                DataInfo         = new StreamedSequenceInfo(typeof(Cook[]), Expression.Constant(new Cook())),
                SqlTables        = { _sqlTable },
            };

            _tupleCtor = _tupleCtor = typeof(KeyValuePair <Cook, int>).GetConstructor(new[] { typeof(Cook), typeof(int) });
        }
コード例 #17
0
        protected SqlCommandData GenerateSql(QueryModel queryModel)
        {
            var preparationContext            = SqlStatementModelObjectMother.CreateSqlPreparationContext();
            var uniqueIdentifierGenerator     = new UniqueIdentifierGenerator();
            var resultOperatorHandlerRegistry = ResultOperatorHandlerRegistry.CreateDefault();
            var sqlStatement = SqlPreparationQueryModelVisitor.TransformQueryModel(
                queryModel,
                preparationContext,
                new DefaultSqlPreparationStage(CompoundMethodCallTransformerProvider.CreateDefault(), resultOperatorHandlerRegistry, uniqueIdentifierGenerator),
                _generator,
                resultOperatorHandlerRegistry);

            var resolver = new MappingResolverStub();
            var mappingResolutionStage   = new DefaultMappingResolutionStage(resolver, uniqueIdentifierGenerator);
            var mappingResolutionContext = new MappingResolutionContext();
            var newSqlStatement          = mappingResolutionStage.ResolveSqlStatement(sqlStatement, mappingResolutionContext);

            var commandBuilder     = new SqlCommandBuilder();
            var sqlGenerationStage = new DefaultSqlGenerationStage();

            sqlGenerationStage.GenerateTextForOuterSqlStatement(commandBuilder, newSqlStatement);

            return(commandBuilder.GetCommand());
        }