protected DefaultSqlPreparationStage CreateDefaultSqlPreparationStage()
 {
     return(new DefaultSqlPreparationStage(
                CompoundMethodCallTransformerProvider.CreateDefault(),
                ResultOperatorHandlerRegistry.CreateDefault(),
                UniqueIdentifierGenerator));
 }
Exemple #2
0
 public void SetUp()
 {
     _generator = new UniqueIdentifierGenerator();
     _stage     = new DefaultSqlPreparationStage(
         CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);
     _handler = new AverageResultOperatorHandler();
     _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
        public void CreateDefault()
        {
            var registry = CompoundMethodCallTransformerProvider.CreateDefault();

            Assert.That(registry.Providers.Length, Is.EqualTo(2));
            Assert.That(registry.Providers[0], Is.TypeOf(typeof(MethodInfoBasedMethodCallTransformerRegistry)));
            Assert.That(registry.Providers[1], Is.TypeOf(typeof(NameBasedMethodCallTransformerRegistry)));
        }
 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));
 }
Exemple #5
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();
        }
Exemple #6
0
 public void SetUp()
 {
     _generator = new UniqueIdentifierGenerator();
     _stage     = new DefaultSqlPreparationStage(
         CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);
     _handler             = new DefaultIfEmptyResultOperatorHandler();
     _sqlStatementBuilder = new SqlStatementBuilder(SqlStatementModelObjectMother.CreateSqlStatement())
     {
         DataInfo = new StreamedSequenceInfo(typeof(Cook[]), Expression.Constant(new Cook()))
     };
     _context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
 }
Exemple #7
0
 public void SetUp()
 {
     _generator           = new UniqueIdentifierGenerator();
     _stage               = new DefaultSqlPreparationStage(CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);
     _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);
        }
        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 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);
        }
Exemple #11
0
        protected SqlCommandData GenerateSql(QueryModel queryModel)
        {
            var generator = new UniqueIdentifierGenerator();

            var resultOperatorHandlerRegistry = ResultOperatorHandlerRegistry.CreateDefault();
            var defaultSqlPreparationStage    = new DefaultSqlPreparationStage(CompoundMethodCallTransformerProvider.CreateDefault(), resultOperatorHandlerRegistry, generator);
            var sqlStatement = defaultSqlPreparationStage.PrepareSqlStatement(queryModel, null);

            var resolver = new MappingResolverStub();
            var mappingResolutionStage   = new DefaultMappingResolutionStage(resolver, generator);
            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());
        }
Exemple #12
0
 private QueryExecutor CreateQueryExecutor(IQueryResultRetriever retrieverMock)
 {
     return(new QueryExecutor(_resolverStub, retrieverMock, ResultOperatorHandlerRegistry.CreateDefault(), CompoundMethodCallTransformerProvider.CreateDefault(), false));
 }