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); }
public AggregateGroupBy GetGroupBy() { if (!_hasGroupBy || OnlyAggregate) { return(null); } var groupBy = new AggregateGroupBy(); foreach (var item in _aggregateDict.Values) { if (!item.Aggregate) { groupBy.SetGroupField(item); } } return(groupBy); }
public AggregateGroupBy GetGroupBy() { if (!_hasGroupBy || _onlyAggregate) { return(null); } AggregateGroupBy groupBy = new AggregateGroupBy(); foreach (AggregateDataFieldInfo item in _aggregateDict.Values) { if (!item.Aggregate) { groupBy.SetGroupField(item); } } return(groupBy); }
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); }