Beispiel #1
0
        /// <summary>
        /// 异步的,批量将一组实体对象插入到库中。
        /// </summary>
        /// <param name="entities">一组要插入实体对象。</param>
        /// <param name="batchSize">每一个批次插入的实体数量。默认为 1000。</param>
        /// <param name="completePercentage">已完成百分比的通知方法。</param>
        /// <param name="cancellationToken">取消操作的通知。</param>
        public async virtual Task BatchInsertAsync(IEnumerable <TEntity> entities, int batchSize = 1000, Action <int> completePercentage = null, CancellationToken cancellationToken = default)
        {
            Guard.ArgumentNull(entities, nameof(entities));
            cancellationToken.ThrowIfCancellationRequested();

            await _repositoryProxy.BatchInsertAsync(entities, batchSize, completePercentage, cancellationToken);
        }