コード例 #1
0
        public virtual async Task <int> CreateManyAsync(IList <T> entities)
        {
            await _dbContext.AddRangeAsync(entities);

            int createdRecordsCount;

            try
            {
                createdRecordsCount = await _dbContext.SaveChangesAsync();
            }
            catch (DbUpdateException due)
            {
                _logger.LogError(due.Message, due.InnerException);
                throw;
            }

            return(createdRecordsCount);
        }