Ejemplo n.º 1
0
        internal int ExecuteLinqNonQuery <TEntity>(IQueryable baseQuery, LinqOperation operation)
        {
            Util.CheckParam(baseQuery, nameof(baseQuery));
            var updateEnt = Context.App.Model.GetEntityInfo(typeof(TEntity));
            var command   = LinqCommandFactory.CreateLinqNonQuery(this, baseQuery.Expression, operation, updateEnt);
            var objResult = this.ExecuteLinqCommand(command);

            return((int)objResult);
        }
Ejemplo n.º 2
0
        public void ScheduleLinqNonQuery <TEntity>(IQueryable baseQuery, LinqOperation op,
                                                   CommandSchedule schedule = CommandSchedule.TransactionEnd)
        {
            Util.Check(baseQuery is EntityQuery, "query parameter should an EntityQuery.");
            var model     = Context.App.Model;
            var targetEnt = model.GetEntityInfo(typeof(TEntity));

            Util.Check(targetEnt != null, "Generic parameter {0} is not an entity registered in the Model.", typeof(TEntity));
            var command = LinqCommandFactory.CreateLinqNonQuery(this, baseQuery.Expression, op, targetEnt);

            switch (schedule)
            {
            case CommandSchedule.TransactionStart:
                ScheduledCommandsAtStart = ScheduledCommandsAtStart ?? new List <LinqCommand>();
                ScheduledCommandsAtStart.Add(command);
                break;

            case CommandSchedule.TransactionEnd:
                ScheduledCommandsAtEnd = ScheduledCommandsAtEnd ?? new List <LinqCommand>();
                ScheduledCommandsAtEnd.Add(command);
                break;
            }
        }