From a68c3b8ec5c656cb8e82d177b78e9bfc80bf233c Mon Sep 17 00:00:00 2001 From: xuejiaming <326308290@qq.com> Date: Mon, 6 Dec 2021 14:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=ACx.3.1.68?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=9C=A867=E7=89=88=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=B8=8A=E9=92=88=E5=AF=B9=E5=86=85=E5=AD=98?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BA=86=E4=BC=98=E5=8C=96x.3.1.67=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=AF=E4=BB=A5=E8=AE=A4=E4=B8=BA=E6=98=AFsharding?= =?UTF-8?q?=20sphere=E7=9A=84=E9=93=BE=E6=8E=A5=E6=A8=A1=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E5=A4=8D=E5=88=BB,x.3.1.68=E7=89=88=E6=9C=AC=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E6=AD=A4=E5=9F=BA=E7=A1=80=E4=B8=8A=E7=9A=84=E5=A4=A7=E5=B9=85?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShardingCoreBenchmark/EFCoreCrud.cs | 119 +++++++++--------- nuget-publish.bat | 8 +- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/benchmarks/ShardingCoreBenchmark/EFCoreCrud.cs b/benchmarks/ShardingCoreBenchmark/EFCoreCrud.cs index 04b48f7e..7c385e23 100644 --- a/benchmarks/ShardingCoreBenchmark/EFCoreCrud.cs +++ b/benchmarks/ShardingCoreBenchmark/EFCoreCrud.cs @@ -64,75 +64,76 @@ namespace ShardingCore6x .UseSqlServer(connection) ) //.AddDefaultDataSource("ds0", "server=127.0.0.1;port=3306;database=db2;userid=root;password=L6yBtV6qNENrwBy7;") - .AddDefaultDataSource("ds0", "Data Source=localhost;Initial Catalog=db2;Integrated Security=True;") + //.AddDefaultDataSource("ds0", "Data Source=localhost;Initial Catalog=db2;Integrated Security=True;") + .AddDefaultDataSource("ds0", "Data Source=localhost;Initial Catalog=db1;Integrated Security=True;") .AddShardingTableRoute(op => { - op.AddShardingTableRoute(); + //op.AddShardingTableRoute(); }).End(); var buildServiceProvider = services.BuildServiceProvider(); buildServiceProvider.GetRequiredService().Start(); - ICollection orders = new LinkedList(); + //ICollection orders = new LinkedList(); - using (var scope = buildServiceProvider.CreateScope()) - { - var defaultShardingDbContext = scope.ServiceProvider.GetService(); - defaultShardingDbContext.Database.EnsureCreated(); - if (!defaultShardingDbContext.Set().Any()) - { - var begin = DateTime.Now.Date.AddDays(-8); - var now = DateTime.Now; - var current = begin; - int i = 0; - var x = new OrderStatusEnum[] { OrderStatusEnum.Failed, OrderStatusEnum.NotPay, OrderStatusEnum.Succeed }; - while (current < now) - { - orders.Add(new Order() - { - Id = i.ToString(), - Amount = i, - Body = $"今天购买了的东西呀:{i}", - CreateTime = current, - Remark = $"这是我的备注哦备注哦备注哦:{i}", - Payer = Guid.NewGuid().ToString("n"), - OrderStatus = x[i % 3] - }); - i++; - current = current.AddMilliseconds(100); - } - var sp = Stopwatch.StartNew(); - defaultShardingDbContext.BulkInsert(orders.ToList()); - sp.Stop(); - Console.WriteLine($"批量插入订单数据:{orders.Count},用时:{sp.ElapsedMilliseconds}"); - } + //using (var scope = buildServiceProvider.CreateScope()) + //{ + // var defaultShardingDbContext = scope.ServiceProvider.GetService(); + // defaultShardingDbContext.Database.EnsureCreated(); + // if (!defaultShardingDbContext.Set().Any()) + // { + // var begin = DateTime.Now.Date.AddDays(-8); + // var now = DateTime.Now; + // var current = begin; + // int i = 0; + // var x = new OrderStatusEnum[] { OrderStatusEnum.Failed, OrderStatusEnum.NotPay, OrderStatusEnum.Succeed }; + // while (current < now) + // { + // orders.Add(new Order() + // { + // Id = i.ToString(), + // Amount = i, + // Body = $"今天购买了的东西呀:{i}", + // CreateTime = current, + // Remark = $"这是我的备注哦备注哦备注哦:{i}", + // Payer = Guid.NewGuid().ToString("n"), + // OrderStatus = x[i % 3] + // }); + // i++; + // current = current.AddMilliseconds(100); + // } + // var sp = Stopwatch.StartNew(); + // defaultShardingDbContext.BulkInsert(orders.ToList()); + // sp.Stop(); + // Console.WriteLine($"批量插入订单数据:{orders.Count},用时:{sp.ElapsedMilliseconds}"); + // } - } - using (var scope = buildServiceProvider.CreateScope()) - { - var defaultShardingDbContext = scope.ServiceProvider.GetService(); - if (!defaultShardingDbContext.Set().Any()) - { - var sp = Stopwatch.StartNew(); - var bulkShardingEnumerable = defaultShardingDbContext.BulkShardingTableEnumerable(orders.ToList()); - foreach (var keyValuePair in bulkShardingEnumerable) - { - keyValuePair.Key.BulkInsert(keyValuePair.Value.ToList()); - } - sp.Stop(); - Console.WriteLine($"批量插入订单数据:{orders.Count},用时:{sp.ElapsedMilliseconds}"); - } - } + //} + //using (var scope = buildServiceProvider.CreateScope()) + //{ + // var defaultShardingDbContext = scope.ServiceProvider.GetService(); + // if (!defaultShardingDbContext.Set().Any()) + // { + // var sp = Stopwatch.StartNew(); + // var bulkShardingEnumerable = defaultShardingDbContext.BulkShardingTableEnumerable(orders.ToList()); + // foreach (var keyValuePair in bulkShardingEnumerable) + // { + // keyValuePair.Key.BulkInsert(keyValuePair.Value.ToList()); + // } + // sp.Stop(); + // Console.WriteLine($"批量插入订单数据:{orders.Count},用时:{sp.ElapsedMilliseconds}"); + // } + //} _defaultDbContext = ShardingContainer.GetService(); _defaultShardingDbContext = ShardingContainer.GetService(); - _virtualTableManager = ShardingContainer.GetService>(); - _virtualTable = _virtualTableManager.GetVirtualTable(); - _routeTailFactory = ShardingContainer.GetService(); - _streamMergeContextFactory = - ShardingContainer.GetService>(); - _actualConnectionStringManager = new ActualConnectionStringManager(); - _virtualDataSource = ShardingContainer.GetService>(); - _dataSourceRouteRuleEngineFactory = ShardingContainer.GetService>(); - _tableRouteRuleEngineFactory = ShardingContainer.GetService>(); + //_virtualTableManager = ShardingContainer.GetService>(); + //_virtualTable = _virtualTableManager.GetVirtualTable(); + //_routeTailFactory = ShardingContainer.GetService(); + //_streamMergeContextFactory = + // ShardingContainer.GetService>(); + //_actualConnectionStringManager = new ActualConnectionStringManager(); + //_virtualDataSource = ShardingContainer.GetService>(); + // _dataSourceRouteRuleEngineFactory = ShardingContainer.GetService>(); + // _tableRouteRuleEngineFactory = ShardingContainer.GetService>(); } diff --git a/nuget-publish.bat b/nuget-publish.bat index b75110c7..d997edca 100644 --- a/nuget-publish.bat +++ b/nuget-publish.bat @@ -1,9 +1,9 @@ :start ::定义版本 -set EFCORE2=2.3.1.67 -set EFCORE3=3.3.1.67 -set EFCORE5=5.3.1.67 -set EFCORE6=6.3.1.67 +set EFCORE2=2.3.1.68 +set EFCORE3=3.3.1.68 +set EFCORE5=5.3.1.68 +set EFCORE6=6.3.1.68 ::删除所有bin与obj下的文件 @echo off