コード例 #1
0
        public async Task BluckUpdate()
        {
            var orders = new List <Order>()
            {
                new Order {
                    Number = "n1", OrderItems = new List <OrderItem> {
                        new OrderItem {
                            SkuId = "S1", Status = "S3"
                        }
                    }
                },
                new Order {
                    Number = "n1", OrderItems = new List <OrderItem> {
                        new OrderItem {
                            SkuId = "S2", Status = "S4"
                        }
                    }
                }
            };
            await CustomRepository.BulkUpdateAsync(orders);

            //for (int i = 0; i < 1000; i++)
            //{
            //    orders.Add(new Product {  Name = "P" + i.ToString() });
            //}
            //System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            //stopwatch.Start();
            ////foreach (var item in orders)
            ////{
            ////    await _productRepository.InsertAsync(item);
            ////}
            //await CurrentUnitOfWork.SaveChangesAsync();
            //stopwatch.Stop();
            //var r2 = stopwatch.ElapsedMilliseconds;
            //stopwatch.Restart();
            ////await CurrentUnitOfWork.GetDbContext<EdwardAbpDbContext>().BulkInsertAsync(orders);
            ////await CurrentUnitOfWork.SaveChangesAsync();
            ////stopwatch.Stop();
            ////var r1 = stopwatch.ElapsedMilliseconds;
            ////stopwatch.Restart();

            //await CustomRepository.BulkInsertAsync(orders);
            //await CurrentUnitOfWork.SaveChangesAsync();

            //stopwatch.Stop();
            //var r3 = stopwatch.ElapsedMilliseconds;

            //_orderRepository.InsertBluck(orders);
        }