Exemplo n.º 1
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public override List <K> ToList()
        {
            QueryCommand queryCommand = _context.Database.QueryJoinData(_context, Mapping, Selector, Models, _query, _order, _distinct, _region);

            return(_context.QueryDataDefineList <K>(Mapping, _level, queryCommand.Command, queryCommand.InnerPage ? null : _region, queryCommand.State, Dele));
        }
Exemplo n.º 4
0
        public async override Task <List <K> > ToListAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            QueryCommand queryCommand = _context.Database.QueryJoinData(_context, Mapping, Selector, Models, _query, _order, _distinct, _region);

            return(await _context.QueryDataDefineListAsync <K>(Mapping, _level, queryCommand.Command, queryCommand.InnerPage?null : _region, queryCommand.State, Dele, cancellationToken));
        }
Exemplo n.º 5
0
        public async override Task <List <K> > ToListAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            QueryCommand queryCommand = _context.Database.QueryDynamicAggregate(_context, Model, _query, _having, _order, _region);

            return(await _context.QueryDataDefineListAsync <K>(Model.OutputMapping, _level, queryCommand.Command, queryCommand.InnerPage?null : _region, queryCommand.State, null, cancellationToken));
        }
Exemplo n.º 6
0
        public override List <K> ToList()
        {
            QueryCommand queryCommand = _context.Database.QueryDynamicAggregate(_context, Model, _query, _having, _order, _region);

            return(_context.QueryDataDefineList <K>(Model.OutputMapping, _level, queryCommand.Command, queryCommand.InnerPage ? null : _region, queryCommand.State, null));
        }
Exemplo n.º 7
0
        public async override Task <List <T> > ToListAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            QueryCommand queryCommand = _context.Database.QueryEntityData(_context, Mapping, null, _query, _order, false, _region);

            return(await _context.QueryDataDefineListAsync <T>(Mapping, _level, queryCommand.Command, queryCommand.InnerPage?null : _region, queryCommand.State, null, cancellationToken));
        }
Exemplo n.º 8
0
        public override List <T> ToList()
        {
            QueryCommand queryCommand = _context.Database.QueryEntityData(_context, Mapping, null, _query, _order, false, _region);

            return(_context.QueryDataDefineList <T>(Mapping, _level, queryCommand.Command, queryCommand.InnerPage ? null : _region, queryCommand.State, null));
        }
Exemplo n.º 9
0
        public override IEnumerator <T> GetEnumerator()
        {
            QueryCommand queryCommand = _context.Database.QueryEntityData(_context, Mapping, null, _query, _order, false, _region);

            return(_context.QueryDataDefineReader <T>(Mapping, _level, queryCommand.Command, queryCommand.InnerPage ? null : _region, queryCommand.State, null).GetEnumerator());
        }