Example #1
0
        public async Task <bool> BulkInsertOrUpdate(IList <ProductItem> productItems)
        {
            try
            {
                using (var transaction = await _context.Database.BeginTransactionAsync())
                {
                    _logger.LogInformation("Started transaction");

                    _context.BulkInsertOrUpdate(productItems);

                    transaction.Commit();

                    return(await Task.FromResult(true));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(typeof(ProductRepository).GetHashCode(), ex, ex.Message);
            }

            return(await Task.FromResult(false));
        }