public AggregateLambdaState(ParameterExpression parameter, AggregateModel model)
 {
     aggregateModel = model;
     aggregateName  = parameter.Name;
     aggregateType  = parameter.Type;
     MainMapping    = model.EntityMapping;
 }
Exemple #2
0
 public AggregateJoinModel(AggregateModel model, string aliasTableName, JoinConnect connect, QueryExpression query, QueryExpression having, OrderExpression order, JoinSetting setting)
 {
     this._model          = model;
     this._connect        = connect;
     this._query          = query;
     this._having         = having;
     this._order          = order;
     this._aliasTableName = aliasTableName;
     this._joinMapping    = model.OutputMapping;
     if ((setting & JoinSetting.NoDataSetEntityNull) == JoinSetting.NoDataSetEntityNull)
     {
         _noDataSetEntityNull = true;
     }
 }
Exemple #3
0
 public AggregateJoinModel(AggregateModel model, string aliasTableName, JoinConnect connect, QueryExpression query, QueryExpression having, OrderExpression order, JoinSetting setting)
 {
     Model          = model;
     Connect        = connect;
     Query          = query;
     Having         = having;
     Order          = order;
     AliasTableName = aliasTableName;
     JoinMapping    = model.OutputDataMapping;
     if ((setting & JoinSetting.NoDataSetEntityNull) == JoinSetting.NoDataSetEntityNull)
     {
         NoDataSetEntityNull = true;
     }
 }
Exemple #4
0
        public async override Task <K> AggregateFieldAsync <K>(Expression <Func <T, K> > expression, CancellationToken cancellationToken = default(CancellationToken))
        {
            AggregateModel model = LambdaExpressionExtend.CreateAggregateModel(expression);

            model.OnlyAggregate = true;
            Region       region       = new Region(0, 1);
            QueryCommand queryCommand = _context.Database.QueryDynamicAggregate(_context, model, _query, null, _order, region);
            K            target       = await _context.QueryDataDefineSingleAsync <K>(model.OutputMapping, _level, queryCommand.Command, queryCommand.InnerPage? 0 : region.Start, queryCommand.State, null, cancellationToken);

            if (target == null)
            {
                object obj = model.OutputMapping.InitialData();
                target = (K)obj;
            }
            return(target);
        }
Exemple #5
0
        public override K AggregateField <K>(Expression <Func <T, K> > expression)
        {
            AggregateModel model = LambdaExpressionExtend.CreateAggregateModel(expression);

            model.OnlyAggregate = true;
            Region region = new Region(0, 1);
            //target = _context.QueryDynamicAggregateSingle<K>(model, _query, null, _order, region, _level, null);
            QueryCommand queryCommand = _context.Database.QueryDynamicAggregate(_context, model, _query, null, _order, region);
            K            target       = _context.QueryDataDefineSingle <K>(model.OutputMapping, _level, queryCommand.Command, queryCommand.InnerPage ? 0 : region.Start, queryCommand.State, null);

            if (target == null)
            {
                object obj = model.OutputMapping.InitialData();
                target = (K)obj;
            }
            return(target);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
0
 public AggregateMap(AggregateModel model)
 {
     _model = model;
 }
Exemple #9
0
 public AggregateMap(AggregateModel model)
 {
     this._model = model;
 }