예제 #1
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);
        }
예제 #2
0
        public virtual QueryCommand QueryJoinData(DataContext context, DataMapping mapping, ISelector selector, List <IJoinModel> models, QueryExpression query, OrderExpression order, bool distinct, Region region)
        {
            CreateSqlState state       = new CreateSqlState(context);
            CommandData    commandData = _factory.CreateSelectJoinTableCommand(selector, models, query, order, distinct, region, state);
            DbCommand      command     = commandData.CreateCommand(this, state);
            QueryState     queryState  = new QueryState();

            foreach (IJoinModel model in models)
            {
                if (model.NoDataSetEntityNull)
                {
                    queryState.SetNoDataSetNull(model.AliasTableName);
                }
            }
            queryState.SetSelector(selector);
            QueryCommand queryCommand = new QueryCommand()
            {
                Command   = command,
                InnerPage = commandData.InnerPage,
                State     = queryState
            };

            return(queryCommand);
        }
예제 #3
0
        public virtual QueryCommand QueryEntityData(DataContext context, DataEntityMapping mapping, ISelector selector, QueryExpression query, OrderExpression order, bool distinct, Region region)
        {
            RelationMap relationMap = mapping.GetRelationMap();

            if (selector == null)
            {
                selector = relationMap.GetDefaultSelector();
            }
            CreateSqlState state       = new CreateSqlState(context);
            CommandData    commandData = _factory.CreateSelectDataCommand(mapping, relationMap, selector, query, order, distinct, region, state);
            DbCommand      command     = commandData.CreateCommand(this, state);
            QueryState     queryState  = new QueryState();

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

            return(queryCommand);
        }