예제 #1
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());
        }
예제 #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);
        }