示例#1
0
        public override int SaveChanges(
            IReadOnlyList <InternalEntityEntry> entries)
        {
            Check.NotNull(entries, nameof(entries));

            var commandBatches = _batchPreparer.BatchCommands(entries, _options);

            return(_batchExecutor.Execute(commandBatches, _connection));
        }
示例#2
0
        public override int SaveChanges(
            IReadOnlyList <StateEntry> stateEntries)
        {
            Check.NotNull(stateEntries, "stateEntries");

            var commandBatches = _batchPreparer.BatchCommands(stateEntries, _options);

            return(_batchExecutor.Execute(commandBatches, _connection));
        }
        public override Task <int> SaveChangesAsync(
            IReadOnlyList <StateEntry> stateEntries,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Check.NotNull(stateEntries, "stateEntries");

            var commandBatches = _batchPreparer.BatchCommands(stateEntries);

            return(_batchExecutor.ExecuteAsync(commandBatches, _connection, cancellationToken));
        }
示例#4
0
        public override async Task <int> SaveChangesAsync(
            IReadOnlyList <StateEntry> stateEntries,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Check.NotNull(stateEntries, "stateEntries");

            var commands = _batchPreparer.BatchCommands(stateEntries);

            await _connection.OpenAsync(cancellationToken);

            try
            {
                await _batchExecutor.ExecuteAsync(commands, cancellationToken);
            }
            finally
            {
                _connection.Close();
            }

            // TODO Return the actual results once we can get them
            return(stateEntries.Count());
        }