Esempio n. 1
0
        public virtual QueryCommand SelectInsertWithAggregate(DataContext context, InsertSelector selector, AggregateModel model, QueryExpression query, QueryExpression having, OrderExpression order)
        {
            CreateSqlState    state        = new CreateSqlState(context);
            AggregateSelector aselector    = model.GetSelector();
            AggregateGroupBy  groupBy      = model.GetGroupBy();
            CommandData       commandData  = _factory.CreateSelectInsertCommand(selector, model.EntityMapping, aselector, groupBy, query, having, order, state);
            DbCommand         command      = commandData.CreateCommand(this, state);
            QueryCommand      queryCommand = new QueryCommand()
            {
                Command = command
            };

            return(queryCommand);
        }
Esempio n. 2
0
        public virtual QueryCommand QueryDynamicAggregate(DataContext context, AggregateModel model, QueryExpression query, QueryExpression having, OrderExpression order, Region region)
        {
            CreateSqlState    state       = new CreateSqlState(context);
            AggregateSelector selector    = model.GetSelector();
            AggregateGroupBy  groupBy     = model.GetGroupBy();
            CommandData       commandData = _factory.CreateAggregateTableCommand(model.EntityMapping, selector, groupBy, query, having, order, region, state);
            DbCommand         command     = commandData.CreateCommand(this, state);
            QueryState        queryState  = new QueryState();

            queryState.SetSelector(selector);
            QueryCommand queryCommand = new QueryCommand()
            {
                Command   = command,
                InnerPage = commandData.InnerPage,
                State     = queryState
            };

            return(queryCommand);
        }
Esempio n. 3
0
        public string CreateSqlString(CommandFactory factory, CreateSqlState state)
        {
            StringBuilder sb        = new StringBuilder();
            CommandData   command   = factory.CreateAggregateTableCommand(_model.EntityMapping, _model.GetSelector(), Model.GetGroupBy(), _query, _having, null, null, state);
            string        aliasName = _aliasTableName;// ?? factory.CreateDataTableMappingSql(_model.EntityMapping, state);

            sb.Append(factory.CreateAliasQuerySql(command.CommandText, aliasName));
            return(sb.ToString());
        }