Beispiel #1
0
        public DefaultSqlPreparationStage(
            IMethodCallTransformerProvider methodCallTransformerProvider,
            ResultOperatorHandlerRegistry resultOperatorHandlerRegistry,
            UniqueIdentifierGenerator uniqueIdentifierGenerator)
        {
            ArgumentUtility.CheckNotNull("methodCallTransformerProvider", methodCallTransformerProvider);
            ArgumentUtility.CheckNotNull("resultOperatorHandlerRegistry", resultOperatorHandlerRegistry);
            ArgumentUtility.CheckNotNull("uniqueIdentifierGenerator", uniqueIdentifierGenerator);

            _methodCallTransformerProvider = methodCallTransformerProvider;
            _resultOperatorHandlerRegistry = resultOperatorHandlerRegistry;
            _uniqueIdentifierGenerator     = uniqueIdentifierGenerator;
        }
        protected SqlPreparationQueryModelVisitor(
            ISqlPreparationContext parentContext,
            ISqlPreparationStage stage,
            UniqueIdentifierGenerator generator,
            ResultOperatorHandlerRegistry resultOperatorHandlerRegistry)
        {
            ArgumentUtility.CheckNotNull("stage", stage);
            ArgumentUtility.CheckNotNull("generator", generator);
            ArgumentUtility.CheckNotNull("resultOperatorHandlerRegistry", resultOperatorHandlerRegistry);

            _stage     = stage;
            _generator = generator;
            _resultOperatorHandlerRegistry = resultOperatorHandlerRegistry;

            _sqlStatementBuilder = new SqlStatementBuilder();
            _context             = new SqlPreparationContext(parentContext, _sqlStatementBuilder);
        }
        public static SqlStatement TransformQueryModel(
            QueryModel queryModel,
            ISqlPreparationContext parentPreparationContext,
            ISqlPreparationStage stage,
            UniqueIdentifierGenerator generator,
            ResultOperatorHandlerRegistry resultOperatorHandlerRegistry)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);
            ArgumentUtility.CheckNotNull("stage", stage);
            ArgumentUtility.CheckNotNull("generator", generator);
            ArgumentUtility.CheckNotNull("resultOperatorHandlerRegistry", resultOperatorHandlerRegistry);

            var visitor = new SqlPreparationQueryModelVisitor(parentPreparationContext, stage, generator, resultOperatorHandlerRegistry);

            queryModel.Accept(visitor);

            return(visitor.GetSqlStatement());
        }