|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Diagnostics; |
4 | | -using System.Linq; |
5 | | -using EFCore.BulkExtensions; |
| 1 | +using EFCore.BulkExtensions; |
6 | 2 | using Microsoft.EntityFrameworkCore; |
7 | 3 | using Microsoft.Extensions.DependencyInjection; |
8 | 4 | using Microsoft.Extensions.Logging; |
9 | 5 | using Sample.BulkConsole.DbContexts; |
10 | 6 | using Sample.BulkConsole.Entities; |
11 | 7 | using ShardingCore; |
12 | | -using ShardingCore.Core.PhysicTables; |
13 | | -using ShardingCore.Core.VirtualDatabase.VirtualTables; |
14 | 8 | using ShardingCore.Extensions; |
15 | | -using ShardingCore.TableCreator; |
| 9 | +using System; |
| 10 | +using System.Collections.Generic; |
| 11 | +using System.Diagnostics; |
| 12 | +using System.Linq; |
16 | 13 |
|
17 | 14 | namespace Sample.BulkConsole |
18 | 15 | { |
@@ -45,24 +42,6 @@ static void Main(string[] args) |
45 | 42 | { |
46 | 43 | var myShardingDbContext = serviceScope.ServiceProvider.GetService<MyShardingDbContext>(); |
47 | 44 |
|
48 | | - var virtualTableManager = serviceScope.ServiceProvider.GetService<IVirtualTableManager<MyShardingDbContext>>(); |
49 | | - var virtualTable = virtualTableManager.GetVirtualTable(typeof(Order)); |
50 | | - if (virtualTable == null) |
51 | | - { |
52 | | - return; |
53 | | - } |
54 | | - var now1 = DateTime.Now.Date.AddDays(2); |
55 | | - var tail = virtualTable.GetVirtualRoute().ShardingKeyToTail(now1); |
56 | | - try |
57 | | - { |
58 | | - virtualTableManager.AddPhysicTable(virtualTable, new DefaultPhysicTable(virtualTable, tail)); |
59 | | - var tableCreator = serviceProvider.GetService< IShardingTableCreator < MyShardingDbContext >> (); |
60 | | - tableCreator.CreateTable("ds0", typeof(Order), tail); |
61 | | - } |
62 | | - catch (Exception e) |
63 | | - { |
64 | | - //ignore |
65 | | - } |
66 | 45 | if (!myShardingDbContext.Set<Order>().Any()) |
67 | 46 | { |
68 | 47 | var begin = DateTime.Now.Date.AddDays(-3); |
|
0 commit comments