Пример #1
0
        public async override Task <int> SelectInsertAsync <P>(Expression <Func <K, P> > expression, CancellationToken cancellationToken = default(CancellationToken))
        {
            InsertSelector selector     = LambdaExpressionExtend.CreateAggregateInsertSelector(expression, Model);
            QueryCommand   queryCommand = _context.Database.SelectInsertWithAggregate(_context, selector, Model, _query, _having, _order);

            return(await _context.ExecuteNonQueryAsync(queryCommand.Command, _level, cancellationToken));
        }
Пример #2
0
        public override int SelectInsert <P>(Expression <Func <K, P> > expression)
        {
            InsertSelector selector     = LambdaExpressionExtend.CreateAggregateInsertSelector(expression, Model);
            QueryCommand   queryCommand = _context.Database.SelectInsertWithAggregate(_context, selector, Model, _query, _having, _order);

            return(_context.ExecuteNonQuery(queryCommand.Command, _level));
        }
Пример #3
0
        public async override Task <int> SelectInsertAsync <K>(Expression <Func <T, K> > expression, CancellationToken cancellationToken = default(CancellationToken))
        {
            InsertSelector selector     = LambdaExpressionExtend.CreateInsertSelector(expression);
            QueryCommand   queryCommand = _context.Database.SelectInsert(_context, selector, _mapping, _query, _order, _distinct);

            return(await _context.ExecuteNonQueryAsync(queryCommand.Command, _level, cancellationToken));
        }
Пример #4
0
        public override int SelectInsert <K>(Expression <Func <T, K> > expression)
        {
            InsertSelector selector     = LambdaExpressionExtend.CreateInsertSelector(expression);
            QueryCommand   queryCommand = _context.Database.SelectInsert(_context, selector, _mapping, _query, _order, _distinct);

            return(_context.ExecuteNonQuery(queryCommand.Command, _level));
        }
Пример #5
0
        public virtual QueryCommand SelectInsertWithJoinTable(DataContext context, InsertSelector selector, List <IJoinModel> models, QueryExpression query, OrderExpression order, bool distinct)
        {
            CreateSqlState state        = new CreateSqlState(context);
            CommandData    commandData  = _factory.CreateSelectInsertCommand(selector, models, query, order, distinct, state);
            DbCommand      command      = commandData.CreateCommand(this, state);
            QueryCommand   queryCommand = new QueryCommand()
            {
                Command = command
            };

            return(queryCommand);
        }
Пример #6
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);
        }
Пример #7
0
        public virtual QueryCommand SelectInsert(DataContext context, InsertSelector selector, DataEntityMapping mapping, QueryExpression query, OrderExpression order, bool distinct)
        {
            RelationMap    relationMap = mapping.GetRelationMap();
            CommandData    commandData;
            CreateSqlState state = new CreateSqlState(context);

            if (mapping.HasJoinRelateModel)
            {
                QueryExpression subQuery  = null;
                QueryExpression mainQuery = null;
                OrderExpression subOrder  = null;
                OrderExpression mainOrder = null;
                if (query != null)
                {
                    if (query.MutliQuery)
                    {
                        mainQuery = query;
                    }
                    else
                    {
                        subQuery = query;
                    }
                }
                if (order != null)
                {
                    if (order.MutliOrder)
                    {
                        mainOrder = order;
                    }
                    else
                    {
                        subOrder = order;
                    }
                }
                List <IJoinModel> models = relationMap.CreateJoinModels(subQuery, subOrder);
                commandData = _factory.CreateSelectInsertCommand(selector, models, mainQuery, mainOrder, distinct, state);
            }
            else
            {
                commandData = _factory.CreateSelectInsertCommand(selector, mapping, query, order, distinct, state);
            }
            DbCommand    command      = commandData.CreateCommand(this, state);
            QueryCommand queryCommand = new QueryCommand()
            {
                Command = command
            };

            return(queryCommand);
        }