From 5fb2852db4bacc986caeb383870c34dd71b6dfe0 Mon Sep 17 00:00:00 2001
From: xuejiaming <326308290@qq.com>
Date: Sat, 2 Jul 2022 00:05:35 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=BF=85=E8=A6=81=E7=9A=84?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81tablemanager=E5=92=8Cdatasourcemanager?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
samples/Sample.MySql/Startup.cs | 1 +
.../Controllers/ValuesController.cs | 1 +
samples/Sample.SqlServer/DbContextHelper.cs | 1 +
src/ShardingCore/Core/Check.cs | 4 +-
.../Core/IShardingRuntimeContextFactory.cs | 7 -
.../Core/IShardingRuntimeModel.cs | 12 -
.../Core/IShardingRuntimeModelCacheFactory.cs | 11 -
.../Core/IShardingRuntimeModelOptions.cs | 8 -
.../Core/PhysicTables/DefaultPhysicTable.cs | 97 --------
.../Core/PhysicTables/IPhysicTable.cs | 48 ----
.../Abstractions/ITableRouteAssert.cs | 2 +-
.../IShardingRuntimeContext.cs | 3 +-
.../ShardingRuntimeContext.cs | 10 +-
.../IShardingConfigurationOptions.cs | 12 -
.../ConfigBuilders/ShardingConfigBuilder.cs | 160 -------------
.../ShardingCoreConfigBuilder.cs | 1 +
.../ShardingMultiConfigurationOptions.cs | 32 ---
.../ShardingSingleConfigurationOptions.cs | 28 ---
.../IShardingDatabaseProvider.cs | 10 -
.../ShardingDatabaseProvider.cs | 22 --
.../IVirtualDataSourceAccessor.cs | 13 -
.../Abstractions/IVirtualDataSourceManager.cs | 32 ---
.../ShardingConfigurationStrategyEnum.cs | 24 --
...pleVirtualDataSourceConfigurationParams.cs | 2 -
.../VirtualDataSourceAccessor.cs | 24 --
.../VirtualDataSourceContext.cs | 18 --
.../VirtualDataSourceManager.cs | 156 ------------
.../VirtualDataSourceScope.cs | 34 ---
.../VirtualTables/DefaultVirtualTable.cs | 132 ----------
.../VirtualTables/IVirtualTable.cs | 87 -------
.../VirtualTables/IVirtualTableManager.cs | 61 -----
.../VirtualTables/VirtualTableManager.cs | 226 ------------------
.../Abstractions/ITableRouteManager.cs | 38 ++-
...ShardingRouteUnit.cs => TableRouteUnit.cs} | 8 +-
...AbstractShardingFilterVirtualTableRoute.cs | 14 +-
...stractShardingOperatorVirtualTableRoute.cs | 8 +-
.../Abstractions/AbstractVirtualTableRoute.cs | 4 +-
.../TableRoutes/IVirtualTableRoute.cs | 4 +-
.../RoutingRuleEngine/TableRouteResult.cs | 6 +-
.../RoutingRuleEngine/TableRouteRuleEngine.cs | 10 +-
.../TableRoutes/TableRouteManager.cs | 7 +-
.../ShardingOptionsExtension.cs | 1 +
.../EFCores/ShardingInternalDbSet.cs | 1 +
.../EFCores/ShardingModelCustomizer.cs | 1 +
.../EFCores/ShardingQueryCompiler.cs | 1 +
.../Extensions/DbContextExtension.cs | 1 +
.../Extensions/ShardingDbContextExtension.cs | 1 +
.../Extensions/ShardingExtension.cs | 1 +
.../Extensions/ShardingReadWriteExtension.cs | 1 +
src/ShardingCore/Helpers/MigrationHelper.cs | 1 +
.../AsyncTrackerEnumerator.cs | 1 +
.../TrackerEnumerators/TrackerEnumerator.cs | 1 +
.../Common/UnSupportSqlRouteUnit.cs | 2 +-
.../DataSourceDbContext.cs | 1 +
.../ShardingDbContextExecutor.cs | 1 +
.../MergeQueryCompilerContext.cs | 1 +
.../ShardingExecutors/QueryCompilerContext.cs | 1 +
.../Sharding/StreamMergeContext.cs | 1 +
src/ShardingCore/ShardingCore.csproj | 1 -
src/ShardingCore/ShardingCoreExtension.cs | 1 +
src/ShardingCore/ShardingRuntimeBuilder.cs | 1 +
61 files changed, 95 insertions(+), 1304 deletions(-)
delete mode 100644 src/ShardingCore/Core/IShardingRuntimeContextFactory.cs
delete mode 100644 src/ShardingCore/Core/IShardingRuntimeModel.cs
delete mode 100644 src/ShardingCore/Core/IShardingRuntimeModelCacheFactory.cs
delete mode 100644 src/ShardingCore/Core/IShardingRuntimeModelOptions.cs
delete mode 100644 src/ShardingCore/Core/PhysicTables/DefaultPhysicTable.cs
delete mode 100644 src/ShardingCore/Core/PhysicTables/IPhysicTable.cs
rename src/ShardingCore/Core/{ => RuntimeContexts}/IShardingRuntimeContext.cs (95%)
rename src/ShardingCore/Core/{ => RuntimeContexts}/ShardingRuntimeContext.cs (95%)
delete mode 100644 src/ShardingCore/Core/ShardingConfigurations/Abstractions/IShardingConfigurationOptions.cs
delete mode 100644 src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingConfigBuilder.cs
delete mode 100644 src/ShardingCore/Core/ShardingConfigurations/ShardingMultiConfigurationOptions.cs
delete mode 100644 src/ShardingCore/Core/ShardingConfigurations/ShardingSingleConfigurationOptions.cs
delete mode 100644 src/ShardingCore/Core/ShardingDatabaseProviders/IShardingDatabaseProvider.cs
delete mode 100644 src/ShardingCore/Core/ShardingDatabaseProviders/ShardingDatabaseProvider.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceAccessor.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceManager.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Common/ShardingConfigurationStrategyEnum.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceAccessor.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceContext.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceManager.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceScope.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualTables/DefaultVirtualTable.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTable.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTableManager.cs
delete mode 100644 src/ShardingCore/Core/VirtualDatabase/VirtualTables/VirtualTableManager.cs
rename src/ShardingCore/Core/VirtualRoutes/{ShardingRouteUnit.cs => TableRouteUnit.cs} (70%)
diff --git a/samples/Sample.MySql/Startup.cs b/samples/Sample.MySql/Startup.cs
index 87038261..3cd508d6 100644
--- a/samples/Sample.MySql/Startup.cs
+++ b/samples/Sample.MySql/Startup.cs
@@ -3,6 +3,7 @@ using Sample.MySql.DbContexts;
using Sample.MySql.Shardings;
using ShardingCore;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Extensions;
namespace Sample.MySql
diff --git a/samples/Sample.SqlServer/Controllers/ValuesController.cs b/samples/Sample.SqlServer/Controllers/ValuesController.cs
index cf94c02e..03bd8d2a 100644
--- a/samples/Sample.SqlServer/Controllers/ValuesController.cs
+++ b/samples/Sample.SqlServer/Controllers/ValuesController.cs
@@ -14,6 +14,7 @@ using System.Threading.Tasks;
using ShardingCore.Core.VirtualRoutes.TableRoutes;
using ShardingCore.Extensions.ShardingQueryableExtensions;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
namespace Sample.SqlServer.Controllers
diff --git a/samples/Sample.SqlServer/DbContextHelper.cs b/samples/Sample.SqlServer/DbContextHelper.cs
index 24d00812..6d1f2331 100644
--- a/samples/Sample.SqlServer/DbContextHelper.cs
+++ b/samples/Sample.SqlServer/DbContextHelper.cs
@@ -2,6 +2,7 @@
using Sample.SqlServer.DbContexts;
using ShardingCore;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
namespace Sample.SqlServer
{
diff --git a/src/ShardingCore/Core/Check.cs b/src/ShardingCore/Core/Check.cs
index 2f2cc9f9..9788e076 100644
--- a/src/ShardingCore/Core/Check.cs
+++ b/src/ShardingCore/Core/Check.cs
@@ -14,7 +14,7 @@ namespace ShardingCore.Core
[ExcludeFromCodeCoverage]
private Check(){}
///
- /// 不能为空
+ /// 涓嶈兘涓虹┖
///
///
///
@@ -28,7 +28,7 @@ namespace ShardingCore.Core
return value;
}
///
- /// 应该为空
+ /// 搴旇涓虹┖
///
///
///
diff --git a/src/ShardingCore/Core/IShardingRuntimeContextFactory.cs b/src/ShardingCore/Core/IShardingRuntimeContextFactory.cs
deleted file mode 100644
index 1d8d90ce..00000000
--- a/src/ShardingCore/Core/IShardingRuntimeContextFactory.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace ShardingCore.Core
-{
- public interface IShardingRuntimeContextFactory
- {
- IShardingRuntimeContext Create();
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore/Core/IShardingRuntimeModel.cs b/src/ShardingCore/Core/IShardingRuntimeModel.cs
deleted file mode 100644
index 5bd8d0ba..00000000
--- a/src/ShardingCore/Core/IShardingRuntimeModel.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace ShardingCore.Core
-{
-
- public interface IShardingRuntimeModel
- {
- IShardingEntityType GetShardingEntityType(Type entityType);
- List GetShardingEntityTypes();
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore/Core/IShardingRuntimeModelCacheFactory.cs b/src/ShardingCore/Core/IShardingRuntimeModelCacheFactory.cs
deleted file mode 100644
index 18620c86..00000000
--- a/src/ShardingCore/Core/IShardingRuntimeModelCacheFactory.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore;
-
-namespace ShardingCore.Core
-{
- public interface IShardingRuntimeModelCacheFactory
- {
- object GetCacheKey();
- object GetCacheKey(Type DbContext);
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore/Core/IShardingRuntimeModelOptions.cs b/src/ShardingCore/Core/IShardingRuntimeModelOptions.cs
deleted file mode 100644
index e9e405a5..00000000
--- a/src/ShardingCore/Core/IShardingRuntimeModelOptions.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace ShardingCore.Core
-{
-
- public interface IShardingRuntimeModelOptions
- {
-
- }
-}
diff --git a/src/ShardingCore/Core/PhysicTables/DefaultPhysicTable.cs b/src/ShardingCore/Core/PhysicTables/DefaultPhysicTable.cs
deleted file mode 100644
index 1d2aebfd..00000000
--- a/src/ShardingCore/Core/PhysicTables/DefaultPhysicTable.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// using System;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.VirtualTables;
-//
-// namespace ShardingCore.Core.PhysicTables
-// {
-// /*
-// * @Author: xjm
-// * @Description:
-// * @Date: Friday, 18 December 2020 13:57:50
-// * @Email: 326308290@qq.com
-// */
-// ///
-// /// 榛樿鐨勭墿鐞嗚〃
-// ///
-// public class DefaultPhysicTable : IPhysicTable
-// {
-// ///
-// /// 鐗╃悊琛
-// ///
-// /// 铏氭嫙琛
-// /// 鐗╃悊琛ㄨ〃鍚庣紑
-// public DefaultPhysicTable(IVirtualTable virtualTable, string tail)
-// {
-// VirtualTable = virtualTable;
-// // OriginalName = virtualTable.GetVirtualTableName();
-// Tail = tail;
-// EntityMetadata = VirtualTable.EntityMetadata;
-// EntityType = EntityMetadata.EntityType;
-// TableSeparator = EntityMetadata.TableSeparator;
-// }
-//
-// ///
-// /// 鍏冩暟鎹璞
-// ///
-// public EntityMetadata EntityMetadata { get; }
-// // ///
-// // /// 鍏ㄨ〃鍚嶇О
-// // ///
-// // public string FullName => $"{OriginalName}{TableSeparator}{Tail}";
-// // ///
-// // /// 鍘熷琛ㄥ悕
-// // ///
-// // public string OriginalName { get; }
-// ///
-// /// 鍒嗚〃鐨勮〃鍚嶅拰鍚庣疆鐨勮繛鎺ュ櫒榛樿涓轰笅鍒掔嚎"_" 鍙互涓虹┖
-// ///
-// public string TableSeparator { get; }
-// ///
-// /// 鍒嗚〃鍚庣紑
-// ///
-// public string Tail { get; }
-// ///
-// /// 绫诲瀷瀵硅薄
-// ///
-// public Type EntityType { get; }
-// ///
-// /// 鎵灞炶櫄鎷熻〃
-// ///
-// public IVirtualTable VirtualTable { get; }
-// protected bool Equals(DefaultPhysicTable other)
-// {
-// return Tail == other.Tail && EntityType == other.EntityType;
-// }
-//
-// public override bool Equals(object obj)
-// {
-// if (ReferenceEquals(null, obj)) return false;
-// if (ReferenceEquals(this, obj)) return true;
-// if (obj.GetType() != this.GetType()) return false;
-// return Equals((DefaultPhysicTable)obj);
-// }
-//
-// #if !EFCORE2
-//
-// public override int GetHashCode()
-// {
-// return HashCode.Combine(TableSeparator, Tail, VirtualTable);
-// }
-// #endif
-//
-// #if EFCORE2
-//
-// public override int GetHashCode()
-// {
-// unchecked
-// {
-// var hashCode = (TableSeparator != null ? TableSeparator.GetHashCode() : 0);
-// hashCode = (hashCode * 397) ^ (Tail != null ? Tail.GetHashCode() : 0);
-// hashCode = (hashCode * 397) ^ (VirtualTable != null ? VirtualTable.GetHashCode() : 0);
-// return hashCode;
-// }
-// }
-// #endif
-//
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/PhysicTables/IPhysicTable.cs b/src/ShardingCore/Core/PhysicTables/IPhysicTable.cs
deleted file mode 100644
index 2cfd9602..00000000
--- a/src/ShardingCore/Core/PhysicTables/IPhysicTable.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// using System;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.VirtualTables;
-//
-// /*
-// * @Author: xjm
-// * @Description:
-// * @Date: Friday, 18 December 2020 13:54:46
-// * @Email: 326308290@qq.com
-// */
-// namespace ShardingCore.Core.PhysicTables
-// {
-// ///
-// /// 鐗╃悊琛ㄦ帴鍙
-// ///
-// public interface IPhysicTable
-// {
-// ///
-// /// 瀵硅薄淇℃伅
-// ///
-// EntityMetadata EntityMetadata { get; }
-// // ///
-// // /// 琛ㄥ叏绉
-// // ///
-// // string FullName { get; }
-// // ///
-// // /// 鍘熻〃鍚嶇О
-// // ///
-// // string OriginalName { get; }
-// ///
-// /// 灏惧反鍓嶇紑 tail prefix
-// ///
-// string TableSeparator { get; }
-// ///
-// /// 灏惧反
-// ///
-// string Tail { get; }
-// ///
-// /// 鏄犲皠绫荤被鍨
-// ///
-// Type EntityType { get; }
-// ///
-// /// 鎵灞炶櫄鎷熻〃
-// ///
-// IVirtualTable VirtualTable { get; }
-//
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/QueryRouteManagers/Abstractions/ITableRouteAssert.cs b/src/ShardingCore/Core/QueryRouteManagers/Abstractions/ITableRouteAssert.cs
index c75dd307..aa9b0e55 100644
--- a/src/ShardingCore/Core/QueryRouteManagers/Abstractions/ITableRouteAssert.cs
+++ b/src/ShardingCore/Core/QueryRouteManagers/Abstractions/ITableRouteAssert.cs
@@ -16,7 +16,7 @@ namespace ShardingCore.Core.QueryRouteManagers.Abstractions
///
public interface ITableRouteAssert
{
- void Assert(DataSourceRouteResult dataSourceRouteResult,List tails, List shardingRouteUnits);
+ void Assert(DataSourceRouteResult dataSourceRouteResult,List tails, List shardingRouteUnits);
}
public interface ITableRouteAssert : ITableRouteAssert where T : class
diff --git a/src/ShardingCore/Core/IShardingRuntimeContext.cs b/src/ShardingCore/Core/RuntimeContexts/IShardingRuntimeContext.cs
similarity index 95%
rename from src/ShardingCore/Core/IShardingRuntimeContext.cs
rename to src/ShardingCore/Core/RuntimeContexts/IShardingRuntimeContext.cs
index 017c8649..f69972a7 100644
--- a/src/ShardingCore/Core/IShardingRuntimeContext.cs
+++ b/src/ShardingCore/Core/RuntimeContexts/IShardingRuntimeContext.cs
@@ -8,14 +8,13 @@ using ShardingCore.Core.ShardingPage.Abstractions;
using ShardingCore.Core.TrackerManagers;
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
-using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
using ShardingCore.Core.VirtualRoutes.Abstractions;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
using ShardingCore.Sharding.Abstractions;
using ShardingCore.Sharding.ParallelTables;
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
-namespace ShardingCore.Core
+namespace ShardingCore.Core.RuntimeContexts
{
public interface IShardingRuntimeContext
diff --git a/src/ShardingCore/Core/ShardingRuntimeContext.cs b/src/ShardingCore/Core/RuntimeContexts/ShardingRuntimeContext.cs
similarity index 95%
rename from src/ShardingCore/Core/ShardingRuntimeContext.cs
rename to src/ShardingCore/Core/RuntimeContexts/ShardingRuntimeContext.cs
index f28e1234..e8d8b05c 100644
--- a/src/ShardingCore/Core/ShardingRuntimeContext.cs
+++ b/src/ShardingCore/Core/RuntimeContexts/ShardingRuntimeContext.cs
@@ -1,7 +1,4 @@
using System;
-using System.Linq;
-using System.Reflection;
-using System.Threading;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -10,23 +7,18 @@ using ShardingCore.Core.DbContextCreator;
using ShardingCore.Core.EntityMetadatas;
using ShardingCore.Core.QueryRouteManagers.Abstractions;
using ShardingCore.Core.QueryTrackers;
-using ShardingCore.Core.ShardingConfigurations.Abstractions;
using ShardingCore.Core.ShardingPage.Abstractions;
using ShardingCore.Core.TrackerManagers;
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualRoutes.Abstractions;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
-using ShardingCore.Exceptions;
-using ShardingCore.Extensions;
using ShardingCore.Logger;
using ShardingCore.Sharding.Abstractions;
-using ShardingCore.Sharding.MergeEngines.ParallelControl;
using ShardingCore.Sharding.ParallelTables;
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
-
-namespace ShardingCore.Core
+namespace ShardingCore.Core.RuntimeContexts
{
public sealed class ShardingRuntimeContext:IShardingRuntimeContext
{
diff --git a/src/ShardingCore/Core/ShardingConfigurations/Abstractions/IShardingConfigurationOptions.cs b/src/ShardingCore/Core/ShardingConfigurations/Abstractions/IShardingConfigurationOptions.cs
deleted file mode 100644
index c8eaeb2a..00000000
--- a/src/ShardingCore/Core/ShardingConfigurations/Abstractions/IShardingConfigurationOptions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-锘// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Sharding.Abstractions;
-//
-// namespace ShardingCore.Core.ShardingConfigurations.Abstractions
-// {
-// public interface IShardingConfigurationOptions
-// {
-// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions);
-//
-// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions();
-// }
-// }
diff --git a/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingConfigBuilder.cs b/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingConfigBuilder.cs
deleted file mode 100644
index 365b715f..00000000
--- a/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingConfigBuilder.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-// using Microsoft.EntityFrameworkCore;
-// using Microsoft.Extensions.DependencyInjection;
-// using Microsoft.Extensions.DependencyInjection.Extensions;
-// using ShardingCore.Core.ShardingConfigurations.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
-// using ShardingCore.DIExtensions;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Extensions;
-// using ShardingCore.Sharding;
-// using ShardingCore.Sharding.Abstractions;
-// using ShardingCore.Sharding.ReadWriteConfigurations;
-// using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
-// using ShardingCore.Sharding.ShardingComparision.Abstractions;
-//
-// namespace ShardingCore.Core.ShardingConfigurations.ConfigBuilders
-// {
-// public class ShardingConfigBuilder where TShardingDbContext:DbContext,IShardingDbContext
-// {
-// public ShardingCoreConfigBuilder ShardingCoreConfigBuilder { get; }
-//
-// public ShardingConfigBuilder(ShardingCoreConfigBuilder shardingCoreConfigBuilder)
-// {
-// ShardingCoreConfigBuilder = shardingCoreConfigBuilder;
-// }
-// ///
-// /// 娣诲姞涓涓垎鐗囬厤缃 蹇呭~ConfigId
鍜AddDefaultDataSource(string dataSourceName, string connectionString)
-// /// 濡傛灉鍏ㄥ眬鏈厤缃 蹇呴』閰嶇疆UseShardingQuery
鍜UseShardingQuery
-// ///
-// ///
-// ///
-// ///
-// ///
-// ///
-// public ShardingConfigBuilder AddConfig(Action shardingGlobalConfigOptionsConfigure)
-// {
-// var shardingGlobalConfigOptions = new ShardingConfigOptions();
-// shardingGlobalConfigOptionsConfigure?.Invoke(shardingGlobalConfigOptions);
-// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.ConfigId))
-// throw new ArgumentNullException(nameof(shardingGlobalConfigOptions.ConfigId));
-// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.DefaultDataSourceName))
-// throw new ArgumentNullException(
-// $"{nameof(shardingGlobalConfigOptions.DefaultDataSourceName)} plz call {nameof(ShardingConfigOptions.AddDefaultDataSource)}");
-//
-// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.DefaultConnectionString))
-// throw new ArgumentNullException(
-// $"{nameof(shardingGlobalConfigOptions.DefaultConnectionString)} plz call {nameof(ShardingConfigOptions.AddDefaultDataSource)}");
-//
-// if (shardingGlobalConfigOptions.ConnectionStringConfigure is null&& ShardingCoreConfigBuilder.ShardingRouteConfigOptions.ConnectionStringConfigure is null)
-// throw new ArgumentNullException($"plz call {nameof(shardingGlobalConfigOptions.UseShardingQuery)}");
-// if (shardingGlobalConfigOptions.ConnectionConfigure is null && ShardingCoreConfigBuilder.ShardingRouteConfigOptions.ConnectionConfigure is null)
-// throw new ArgumentNullException(
-// $"plz call {nameof(shardingGlobalConfigOptions.UseShardingTransaction)}");
-//
-// if (shardingGlobalConfigOptions.MaxQueryConnectionsLimit <= 0)
-// throw new ArgumentException(
-// $"{nameof(shardingGlobalConfigOptions.MaxQueryConnectionsLimit)} should greater than and equal 1");
-// ShardingCoreConfigBuilder.ShardingConfigOptions.Add(shardingGlobalConfigOptions);
-// return this;
-// }
-// ///
-// /// 鍗曢厤缃‘璁
-// ///
-// ///
-// ///
-// public IServiceCollection EnsureConfig(ShardingConfigurationStrategyEnum configurationStrategy = ShardingConfigurationStrategyEnum.ThrowIfNull)
-// {
-// return DoEnsureConfig(false,false, configurationStrategy);
-// }
-// ///
-// /// 鍗曢厤缃‘璁 鑷姩鍒濆鍖栦笉闇瑕佸湪鎵嬪姩IShardingBootstrapper.Start()
-// ///
-// ///
-// ///
-// public IServiceCollection EnsureConfigWithAutoStart(ShardingConfigurationStrategyEnum configurationStrategy = ShardingConfigurationStrategyEnum.ThrowIfNull)
-// {
-// return DoEnsureConfig(false,true, configurationStrategy);
-// }
-// ///
-// /// 澶氶厤缃‘璁
-// ///
-// ///
-// ///
-// public IServiceCollection EnsureMultiConfig(ShardingConfigurationStrategyEnum configurationStrategy= ShardingConfigurationStrategyEnum.ThrowIfNull)
-// {
-// return DoEnsureConfig(true,false, configurationStrategy);
-// }
-// ///
-// /// 澶氶厤缃‘璁 鑷姩鍒濆鍖栦笉闇瑕佸湪鎵嬪姩IShardingBootstrapper.Start()
-// ///
-// ///
-// ///
-// public IServiceCollection EnsureMultiConfigWithAutoStart(ShardingConfigurationStrategyEnum configurationStrategy= ShardingConfigurationStrategyEnum.ThrowIfNull)
-// {
-// return DoEnsureConfig(true,true, configurationStrategy);
-// }
-//
-// private IServiceCollection DoEnsureConfig(bool isMultiConfig,
-// bool autoStart,
-// ShardingConfigurationStrategyEnum configurationStrategy)
-// {
-// if (ShardingCoreConfigBuilder.ShardingConfigOptions.IsEmpty())
-// throw new ArgumentException($"plz call {nameof(AddConfig)} at least once ");
-// if (!isMultiConfig)
-// {
-// if (ShardingCoreConfigBuilder.ShardingConfigOptions.Count > 1)
-// {
-// throw new ArgumentException($"plz call {nameof(AddConfig)} at most once ");
-// }
-// }
-//
-// var services = ShardingCoreConfigBuilder.Services;
-// services.AddSingleton(sp => new DbContextTypeCollector());
-// services.AddSingleton(sp => ShardingCoreConfigBuilder.ShardingRouteConfigOptions);
-// services.AddSingleton(sp => ShardingCoreConfigBuilder.ShardingRouteConfigOptions);
-//
-// services.AddSingleton(sp => CreateShardingConfigurationOptions(isMultiConfig, configurationStrategy));
-// services.AddSingleton>();
-// if (autoStart)
-// {
-//
-// }
-//
-// services.AddInternalShardingCore();
-// return services;
-// }
-//
-// private IShardingConfigurationOptions CreateShardingConfigurationOptions(bool isMultiConfig,
-// ShardingConfigurationStrategyEnum configurationStrategy)
-// {
-// IShardingConfigurationOptions shardingConfigurationOptions;
-// if (!isMultiConfig)
-// {
-// shardingConfigurationOptions = new ShardingSingleConfigurationOptions
-// {
-// ShardingConfigurationStrategy = configurationStrategy
-// };
-// }
-// else
-// {
-// shardingConfigurationOptions = new ShardingMultiConfigurationOptions
-// {
-// ShardingConfigurationStrategy = configurationStrategy
-// };
-// }
-//
-// foreach (var configOptions in ShardingCoreConfigBuilder
-// .ShardingConfigOptions)
-// {
-// shardingConfigurationOptions.AddShardingGlobalConfigOptions(configOptions);
-// }
-//
-// return shardingConfigurationOptions;
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingCoreConfigBuilder.cs b/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingCoreConfigBuilder.cs
index b7f5ba08..16504e5e 100644
--- a/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingCoreConfigBuilder.cs
+++ b/src/ShardingCore/Core/ShardingConfigurations/ConfigBuilders/ShardingCoreConfigBuilder.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.ShardingConfigurations.Abstractions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Core/ShardingConfigurations/ShardingMultiConfigurationOptions.cs b/src/ShardingCore/Core/ShardingConfigurations/ShardingMultiConfigurationOptions.cs
deleted file mode 100644
index 08974d67..00000000
--- a/src/ShardingCore/Core/ShardingConfigurations/ShardingMultiConfigurationOptions.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-锘// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.ShardingConfigurations.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Sharding.Abstractions;
-// using System.Collections.Generic;
-// using System.Linq;
-//
-// namespace ShardingCore.Core.ShardingConfigurations
-// {
-// public class ShardingMultiConfigurationOptions : IShardingConfigurationOptions
-// {
-// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; set; } =
-// ShardingConfigurationStrategyEnum.ThrowIfNull;
-//
-// private Dictionary _shardingGlobalConfigOptions = new ();
-//
-// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions)
-// {
-// if (_shardingGlobalConfigOptions.ContainsKey(shardingConfigOptions.ConfigId))
-// throw new ShardingCoreInvalidOperationException($"repeat add config id:[{shardingConfigOptions.ConfigId}]");
-//
-// _shardingGlobalConfigOptions.Add(shardingConfigOptions.ConfigId, shardingConfigOptions);
-// }
-//
-// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions()
-// {
-// return _shardingGlobalConfigOptions.Values.ToArray();
-// }
-//
-// }
-// }
diff --git a/src/ShardingCore/Core/ShardingConfigurations/ShardingSingleConfigurationOptions.cs b/src/ShardingCore/Core/ShardingConfigurations/ShardingSingleConfigurationOptions.cs
deleted file mode 100644
index 95a4c443..00000000
--- a/src/ShardingCore/Core/ShardingConfigurations/ShardingSingleConfigurationOptions.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-锘// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.ShardingConfigurations.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Sharding.Abstractions;
-//
-// namespace ShardingCore.Core.ShardingConfigurations
-// {
-// public class ShardingSingleConfigurationOptions : IShardingConfigurationOptions
-// {
-//
-// private ShardingConfigOptions _shardingConfigOptions;
-// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; set; } =
-// ShardingConfigurationStrategyEnum.ThrowIfNull;
-//
-// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions)
-// {
-// if (_shardingConfigOptions != null)
-// throw new ShardingCoreInvalidOperationException($"repeat add {nameof(ShardingConfigOptions)}");
-// _shardingConfigOptions= shardingConfigOptions;
-// }
-//
-// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions()
-// {
-// return new[] { _shardingConfigOptions };
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/ShardingDatabaseProviders/IShardingDatabaseProvider.cs b/src/ShardingCore/Core/ShardingDatabaseProviders/IShardingDatabaseProvider.cs
deleted file mode 100644
index d4b986f1..00000000
--- a/src/ShardingCore/Core/ShardingDatabaseProviders/IShardingDatabaseProvider.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace ShardingCore.Core.ShardingDatabaseProviders
-{
-
- public interface IShardingDatabaseProvider
- {
- Type GetShardingDbContextType();
- }
-}
diff --git a/src/ShardingCore/Core/ShardingDatabaseProviders/ShardingDatabaseProvider.cs b/src/ShardingCore/Core/ShardingDatabaseProviders/ShardingDatabaseProvider.cs
deleted file mode 100644
index 50c7e949..00000000
--- a/src/ShardingCore/Core/ShardingDatabaseProviders/ShardingDatabaseProvider.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore;
-using ShardingCore.Sharding.Abstractions;
-
-namespace ShardingCore.Core.ShardingDatabaseProviders
-{
- public class ShardingDatabaseProvider : IShardingDatabaseProvider
- where TShardingDbContext : DbContext, IShardingDbContext
- {
- private readonly Type _shardingDbContextType;
-
- public ShardingDatabaseProvider()
- {
- _shardingDbContextType = typeof(TShardingDbContext);
- }
-
- public Type GetShardingDbContextType()
- {
- return _shardingDbContextType;
- }
- }
-}
\ No newline at end of file
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceAccessor.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceAccessor.cs
deleted file mode 100644
index d6fb0d89..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceAccessor.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions
-// {
-// public interface IVirtualDataSourceAccessor
-// {
-// VirtualDataSourceContext DataSourceContext { get; set; }
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceManager.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceManager.cs
deleted file mode 100644
index df5551f3..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Abstractions/IVirtualDataSourceManager.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.ShardingConfigurations.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
-// using ShardingCore.Sharding.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions
-// {
-// public interface IVirtualDataSourceManager
-// {
-// bool IsMultiShardingConfiguration { get; }
-// ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; }
-// IVirtualDataSource GetCurrentVirtualDataSource();
-// IVirtualDataSource GetVirtualDataSource(string configId);
-// List GetAllVirtualDataSources();
-// bool ContansConfigId(string configId);
-//
-// ///
-// /// 鍒涘缓鍒嗙墖閰嶇疆scope
-// ///
-// ///
-// ///
-// VirtualDataSourceScope CreateScope(string configId);
-// bool AddVirtualDataSource(IVirtualDataSourceConfigurationParams configurationParams);
-// void SetDefaultIfMultiConfiguration();
-//
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Common/ShardingConfigurationStrategyEnum.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Common/ShardingConfigurationStrategyEnum.cs
deleted file mode 100644
index 3f2b5eae..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/Common/ShardingConfigurationStrategyEnum.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common
-{
- public enum ShardingConfigurationStrategyEnum
- {
- ///
- /// 杩斿洖绌
- ///
- ReturnNull = 1,
- ///
- /// 鎶涘嚭寮傚父
- ///
- ThrowIfNull = 1 << 1,
- ///
- /// 杩斿洖浼樺厛绾ф渶楂樼殑
- ///
- ReturnHighPriority = 1 << 2
- }
-}
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/SimpleVirtualDataSourceConfigurationParams.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/SimpleVirtualDataSourceConfigurationParams.cs
index a96dd9af..f2738dd2 100644
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/SimpleVirtualDataSourceConfigurationParams.cs
+++ b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/SimpleVirtualDataSourceConfigurationParams.cs
@@ -9,8 +9,6 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
-using Microsoft.Extensions.DependencyInjection;
-using ShardingCore.Core.ShardingConfigurations.Abstractions;
namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
{
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceAccessor.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceAccessor.cs
deleted file mode 100644
index 6cfc867e..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceAccessor.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading;
-// using System.Threading.Tasks;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
-// {
-// public class VirtualDataSourceAccessor: IVirtualDataSourceAccessor
-// {
-// private static AsyncLocal _shardingConfigurationContext = new AsyncLocal();
-//
-// ///
-// /// sharding route context use in using code block
-// ///
-// public VirtualDataSourceContext DataSourceContext
-// {
-// get => _shardingConfigurationContext.Value;
-// set => _shardingConfigurationContext.Value = value;
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceContext.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceContext.cs
deleted file mode 100644
index 7db4dcfa..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceContext.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
-// {
-// public class VirtualDataSourceContext
-// {
-// public string ConfigId { get; }
-//
-// public VirtualDataSourceContext(string configId)
-// {
-// ConfigId = configId;
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceManager.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceManager.cs
deleted file mode 100644
index 1ba71567..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceManager.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-锘// using System;
-// using System.Collections.Concurrent;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.ShardingConfigurations;
-// using ShardingCore.Core.ShardingConfigurations.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Extensions;
-// using ShardingCore.Sharding.Abstractions;
-// using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
-// {
-// public class VirtualDataSourceManager : IVirtualDataSourceManager
-// {
-// private readonly IShardingConfigurationOptions _options;
-// private readonly IEntityMetadataManager _entityMetadataManager;
-// private readonly IVirtualDataSourceRouteManager _virtualDataSourceRouteManager;
-// private readonly IVirtualDataSourceAccessor _virtualDataSourceAccessor;
-// private readonly IReadWriteConnectorFactory _readWriteConnectorFactory;
-//
-// private readonly ConcurrentDictionary _virtualDataSources = new();
-//
-// private string _defaultConfigId;
-// private IVirtualDataSource _defaultVirtualDataSource;
-// public VirtualDataSourceManager(IServiceProvider serviceProvider, IShardingConfigurationOptions options, IEntityMetadataManager entityMetadataManager, IVirtualDataSourceRouteManager virtualDataSourceRouteManager, IVirtualDataSourceAccessor virtualDataSourceAccessor,IReadWriteConnectorFactory readWriteConnectorFactory)
-// {
-//
-// _options = options;
-// _entityMetadataManager = entityMetadataManager;
-// _virtualDataSourceRouteManager = virtualDataSourceRouteManager;
-// var allShardingGlobalConfigOptions = options.GetAllShardingGlobalConfigOptions();
-// if (allShardingGlobalConfigOptions.IsEmpty())
-// throw new ArgumentException($"sharding virtual data source is empty");
-// _virtualDataSourceAccessor = virtualDataSourceAccessor;
-// _readWriteConnectorFactory = readWriteConnectorFactory;
-// if (options is ShardingMultiConfigurationOptions shardingMultiConfigurationOptions)
-// {
-// IsMultiShardingConfiguration = true;
-// ShardingConfigurationStrategy = shardingMultiConfigurationOptions.ShardingConfigurationStrategy;
-// }
-// else if (options is ShardingSingleConfigurationOptions shardingSingleConfigurationOptions)
-// {
-// IsMultiShardingConfiguration = false;
-// ShardingConfigurationStrategy = shardingSingleConfigurationOptions.ShardingConfigurationStrategy;
-// }
-// foreach (var shardingGlobalConfigOption in allShardingGlobalConfigOptions)
-// {
-// var simpleVirtualDataSourceConfigurationParams = new SimpleVirtualDataSourceConfigurationParams(serviceProvider, shardingGlobalConfigOption);
-// AddVirtualDataSource(simpleVirtualDataSourceConfigurationParams);
-// }
-// if (!IsMultiShardingConfiguration)
-// {
-// if (_defaultVirtualDataSource != null || _defaultConfigId != null)
-// throw new ShardingCoreInvalidOperationException("set sharding configuration error");
-// _defaultConfigId = _virtualDataSources.First().Key;
-// _defaultVirtualDataSource = _virtualDataSources.First().Value;
-// }
-// else if (ShardingConfigurationStrategy == ShardingConfigurationStrategyEnum.ReturnHighPriority)
-// {
-// var maxShardingConfiguration = _virtualDataSources.Values.OrderByDescending(o => o.Priority).FirstOrDefault();
-// _defaultVirtualDataSource = maxShardingConfiguration;
-// _defaultConfigId = maxShardingConfiguration.ConfigId;
-// }
-// }
-// public bool IsMultiShardingConfiguration { get; }
-// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; }
-// public IVirtualDataSource GetCurrentVirtualDataSource()
-// {
-// if (!IsMultiShardingConfiguration)
-// return _defaultVirtualDataSource;
-// var configId = _virtualDataSourceAccessor.DataSourceContext?.ConfigId;
-// if (!string.IsNullOrWhiteSpace(configId))
-// {
-// var hasValue = _virtualDataSources.TryGetValue(configId, out var virtualDataSource);
-// if (hasValue)
-// {
-// return virtualDataSource;
-// }
-// }
-//
-// switch (ShardingConfigurationStrategy)
-// {
-// case ShardingConfigurationStrategyEnum.ReturnNull: return null;
-// case ShardingConfigurationStrategyEnum.ReturnHighPriority: return _defaultVirtualDataSource;
-// case ShardingConfigurationStrategyEnum.ThrowIfNull: throw new ShardingCoreNotFoundException($"no configuration,config id:[{configId}]");
-// default:
-// throw new ShardingCoreException(
-// $"unknown {nameof(ShardingConfigurationStrategyEnum)}:[{ShardingConfigurationStrategy}]");
-// }
-// }
-// public IVirtualDataSource GetVirtualDataSource(string configId)
-// {
-// var hasValue = _virtualDataSources.TryGetValue(configId, out var virtualDataSource);
-// if (hasValue)
-// {
-// return virtualDataSource;
-// }
-// switch (ShardingConfigurationStrategy)
-// {
-// case ShardingConfigurationStrategyEnum.ReturnNull: return null;
-// case ShardingConfigurationStrategyEnum.ReturnHighPriority: return _defaultVirtualDataSource;
-// case ShardingConfigurationStrategyEnum.ThrowIfNull: throw new ShardingCoreNotFoundException($"no configuration,config id:[{configId}]");
-// default:
-// throw new ShardingCoreException(
-// $"unknown {nameof(ShardingConfigurationStrategyEnum)}:[{ShardingConfigurationStrategy}]");
-// }
-// }
-//
-// public bool ContansConfigId(string configId)
-// {
-// return _virtualDataSources.ContainsKey(configId);
-// }
-//
-// public bool AddVirtualDataSource(IVirtualDataSourceConfigurationParams configurationParams)
-// {
-// if (!IsMultiShardingConfiguration&&_virtualDataSources.IsNotEmpty())
-// throw new NotSupportedException("not support multi sharding configuration");
-// var dataSource = new VirtualDataSource(_entityMetadataManager, _virtualDataSourceRouteManager, configurationParams,_readWriteConnectorFactory);
-// dataSource.CheckVirtualDataSource();
-// return _virtualDataSources.TryAdd(dataSource.ConfigId, dataSource);
-// }
-//
-// public void SetDefaultIfMultiConfiguration()
-// {
-// if (IsMultiShardingConfiguration && ShardingConfigurationStrategy == ShardingConfigurationStrategyEnum.ReturnHighPriority)
-// {
-// var maxShardingConfiguration = _virtualDataSources.Values.OrderByDescending(o => o.Priority).FirstOrDefault();
-// if (maxShardingConfiguration.ConfigId != _defaultConfigId)
-// {
-// _defaultConfigId = maxShardingConfiguration.ConfigId;
-// _defaultVirtualDataSource = maxShardingConfiguration;
-// }
-// }
-// }
-// public List GetAllVirtualDataSources()
-// {
-// if (!IsMultiShardingConfiguration)
-// return new List(1) { _defaultVirtualDataSource };
-// return _virtualDataSources.Values.ToList();
-// }
-//
-// public VirtualDataSourceScope CreateScope(string configId)
-// {
-// var virtualDataSourceScope = new VirtualDataSourceScope(_virtualDataSourceAccessor);
-// _virtualDataSourceAccessor.DataSourceContext = new VirtualDataSourceContext(configId);
-// return virtualDataSourceScope;
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceScope.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceScope.cs
deleted file mode 100644
index e2b2e508..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualDataSources/VirtualDataSourceScope.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-锘// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Text;
-// using System.Threading.Tasks;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
-// {
-// public class VirtualDataSourceScope:IDisposable
-// {
-// ///
-// /// 鍒嗙墖閰嶇疆璁块棶鍣
-// ///
-// public IVirtualDataSourceAccessor VirtualDataSourceAccessor { get; }
-//
-// ///
-// /// 鏋勯犲嚱鏁
-// ///
-// ///
-// public VirtualDataSourceScope(IVirtualDataSourceAccessor virtualDataSourceAccessor)
-// {
-// VirtualDataSourceAccessor = virtualDataSourceAccessor;
-// }
-//
-// ///
-// /// 鍥炴敹
-// ///
-// public void Dispose()
-// {
-// VirtualDataSourceAccessor.DataSourceContext = null;
-// }
-// }
-// }
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/DefaultVirtualTable.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualTables/DefaultVirtualTable.cs
deleted file mode 100644
index 1487337c..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/DefaultVirtualTable.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-// using ShardingCore.Core.PhysicTables;
-// using ShardingCore.Core.VirtualRoutes.TableRoutes;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Extensions;
-// using ShardingCore.Sharding.PaginationConfigurations;
-// using ShardingCore.Utils;
-// using System;
-// using System.Collections.Concurrent;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Linq.Expressions;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.ShardingEnumerableQueries;
-// using ShardingCore.Core.VirtualDatabase;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
-// using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
-// using ShardingCore.Sharding.EntityQueryConfigurations;
-// using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualTables
-// {
-// /*
-// * @Author: xjm
-// * @Description:
-// * @Date: Friday, 18 December 2020 14:20:12
-// * @Email: 326308290@qq.com
-// */
-// ///
-// /// 鍚屾暟鎹簱铏氭嫙琛
-// ///
-// ///
-// public class DefaultVirtualTable : IVirtualTable where T : class
-// {
-// public EntityMetadata EntityMetadata { get; }
-// private readonly IVirtualTableRoute _virtualTableRoute;
-//
-// ///
-// /// 鍒嗛〉閰嶇疆
-// ///
-// public PaginationMetadata PaginationMetadata { get; }
-//
-// ///
-// /// 鏄惁鍚敤鏅鸿兘鍒嗛〉
-// ///
-// public bool EnablePagination => PaginationMetadata != null;
-// ///
-// /// 鏌ヨ閰嶇疆
-// ///
-// public EntityQueryMetadata EntityQueryMetadata { get; }
-// ///
-// /// 鏄惁鍚敤琛ㄨ揪寮忓垎鐗囬厤缃
-// ///
-// public bool EnableEntityQuery => EntityQueryMetadata != null;
-//
-//
-// private readonly ConcurrentDictionary _physicTables = new ConcurrentDictionary();
-//
-// public DefaultVirtualTable(IVirtualTableRoute virtualTableRoute,EntityMetadata entityMetadata)
-// {
-// EntityMetadata = entityMetadata;
-// _virtualTableRoute = virtualTableRoute;
-// var paginationConfiguration = virtualTableRoute.CreatePaginationConfiguration();
-// if (paginationConfiguration!=null)
-// {
-// PaginationMetadata = new PaginationMetadata();
-// var paginationBuilder = new PaginationBuilder(PaginationMetadata);
-// paginationConfiguration.Configure(paginationBuilder);
-// }
-//
-// var entityQueryConfiguration = virtualTableRoute.CreateEntityQueryConfiguration();
-// if (entityQueryConfiguration != null)
-// {
-// EntityQueryMetadata = new EntityQueryMetadata();
-// var entityQueryBuilder = new EntityQueryBuilder(EntityQueryMetadata);
-// entityQueryConfiguration.Configure(entityQueryBuilder);
-// }
-// }
-//
-// public List GetAllPhysicTables()
-// {
-// return _physicTables.Keys.ToList();
-// }
-//
-// public List RouteTo(DataSourceRouteResult dataSourceRouteResult,ShardingTableRouteConfig tableRouteConfig)
-// {
-// var route = _virtualTableRoute;
-// if (tableRouteConfig.UseQueryable())
-// return route.RouteWithPredicate(GetAllPhysicTables(), tableRouteConfig.GetQueryable(), true);
-// if (tableRouteConfig.UsePredicate())
-// return route.RouteWithPredicate(GetAllPhysicTables(), new ShardingEmptyEnumerableQuery((Expression>)tableRouteConfig.GetPredicate()).EmptyQueryable(), false);
-// object shardingKeyValue = null;
-// if (tableRouteConfig.UseValue())
-// shardingKeyValue = tableRouteConfig.GetShardingKeyValue();
-//
-// if (tableRouteConfig.UseEntity())
-// shardingKeyValue = tableRouteConfig.GetShardingEntity().GetPropertyValue(EntityMetadata.ShardingTableProperty.Name);
-//
-// if (shardingKeyValue == null)
-// throw new ShardingCoreException(" route entity queryable or sharding key value is null ");
-// var routeWithValue = route.RouteWithValue(GetAllPhysicTables(), shardingKeyValue);
-// return new List(1) { routeWithValue };
-// }
-//
-//
-// public bool AddPhysicTable(IPhysicTable physicTable)
-// {
-// if (physicTable.EntityType != EntityMetadata.EntityType)
-// throw new ShardingCoreInvalidOperationException($"virtual table entity type :[{EntityMetadata.EntityType.FullName}] physic table entity type:[{physicTable.EntityType.FullName}]");
-// return _physicTables.TryAdd(physicTable, null);
-// }
-//
-// // public string GetVirtualTableName()
-// // {
-// // return EntityMetadata.VirtualTableName;
-// // }
-//
-// IVirtualTableRoute IVirtualTable.GetVirtualRoute()
-// {
-// return GetVirtualRoute();
-// }
-//
-// public List GetTableAllTails()
-// {
-// return _physicTables.Keys.Select(o => o.Tail).ToList();
-// }
-//
-// public IVirtualTableRoute GetVirtualRoute()
-// {
-// return _virtualTableRoute;
-// }
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTable.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTable.cs
deleted file mode 100644
index 3535c80c..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTable.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// using System;
-// using System.Collections.Generic;
-// using ShardingCore.Bootstrappers;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.PhysicTables;
-// using ShardingCore.Core.VirtualDatabase;
-// using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
-// using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
-// using ShardingCore.Core.VirtualRoutes.TableRoutes;
-// using ShardingCore.Sharding.EntityQueryConfigurations;
-// using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
-// using ShardingCore.Sharding.PaginationConfigurations;
-//
-// namespace ShardingCore.Core.VirtualTables
-// {
-// /*
-// * @Author: xjm
-// * @Description:铏氭嫙琛ㄥ湪绯荤粺閲岄潰琚槧灏勪负ef-core鐨勮〃
-// * @Date: Friday, 18 December 2020 14:06:31
-// * @Email: 326308290@qq.com
-// */
-// ///
-// /// 铏氭嫙琛
-// ///
-// public interface IVirtualTable
-// {
-// EntityMetadata EntityMetadata { get; }
-// ///
-// /// 鍒嗛〉閰嶇疆
-// ///
-// PaginationMetadata PaginationMetadata { get; }
-// ///
-// /// 鏄惁鍚敤鍒嗛〉閰嶇疆
-// ///
-// bool EnablePagination { get; }
-// ///
-// /// 鏌ヨ閰嶇疆
-// ///
-// EntityQueryMetadata EntityQueryMetadata { get; }
-// ///
-// /// 鏄惁鍚敤琛ㄨ揪寮忓垎鐗囬厤缃
-// ///
-// bool EnableEntityQuery { get; }
-//
-// ///
-// /// 鑾峰彇鎵鏈夌殑鐗╃悊琛
-// ///
-// ///
-// List GetAllPhysicTables();
-//
-// ///
-// /// 璺敱鍒板叿浣撶殑鐗╃悊琛 which physic table route
-// ///
-// ///
-// ///
-// ///
-// List RouteTo(DataSourceRouteResult dataSourceRouteResult,ShardingTableRouteConfig tableRouteConfig);
-//
-// ///
-// /// 娣诲姞鐗╃悊琛 add physic table
-// ///
-// ///
-// /// 娣诲姞鎴愬姛
-// bool AddPhysicTable(IPhysicTable physicTable);
-// // ///
-// // /// 鑾峰彇鍘熷琛ㄥ悕 get original table name
-// // ///
-// // ///
-// // string GetVirtualTableName();
-// ///
-// /// 鑾峰彇褰撳墠铏氭嫙琛ㄧ殑璺敱 get this virtual table route
-// ///
-// ///
-// IVirtualTableRoute GetVirtualRoute();
-// ///
-// /// 鑾峰彇鍚姩鏃跺凡缁忓瓨鍦ㄧ殑琛ㄥ悗缂 get this virtual table exists tails when app start
-// /// CreateDateTables
-// ///
-// ///
-// List GetTableAllTails();
-// }
-//
-// public interface IVirtualTable : IVirtualTable where T : class
-// {
-// new IVirtualTableRoute GetVirtualRoute();
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTableManager.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTableManager.cs
deleted file mode 100644
index 8b866afc..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/IVirtualTableManager.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// using System;
-// using System.Collections.Generic;
-// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.PhysicTables;
-// using ShardingCore.Core.VirtualTables;
-// using ShardingCore.Sharding.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualTables
-// {
-// /*
-// * @Author: xjm
-// * @Description: 鐢ㄤ簬绠$悊铏氭嫙琛ㄥ苟涓旀彁渚涚畝鍗曠殑鎿嶄綔鏂规硶api
-// * @Date: Friday, 18 December 2020 14:10:03
-// * @Email: 326308290@qq.com
-// */
-// [Obsolete]
-// public interface IVirtualTableManager
-// {
-//
-// ///
-// /// 娣诲姞铏氭嫙琛ㄥ簲鐢ㄥ惎鍔ㄦ椂 add virtual table when app start
-// ///
-// /// 铏氭嫙琛
-// bool AddVirtualTable(IVirtualTable virtualTable);
-//
-// ///
-// /// 鑾峰彇铏氭嫙琛 get virtual table by sharding entity type
-// ///
-// ///
-// ///
-// IVirtualTable GetVirtualTable(Type shardingEntityType);
-// ///
-// /// 灏濊瘯鑾峰彇铏氭嫙琛
-// ///
-// ///
-// ///
-// IVirtualTable TryGetVirtualTable(Type shardingEntityType);
-//
-// ///
-// /// 鑾峰彇鎵鏈夌殑铏氭嫙琛 get all virtual table
-// ///
-// ///
-// ISet GetAllVirtualTables();
-//
-//
-// ///
-// /// 娣诲姞鐗╃悊琛 add physic table
-// ///
-// ///
-// ///
-// bool AddPhysicTable(IVirtualTable virtualTable, IPhysicTable physicTable);
-//
-//
-// ///
-// /// 娣诲姞鐗╃悊琛 add physic table
-// ///
-// ///
-// ///
-// bool AddPhysicTable(Type shardingEntityType, IPhysicTable physicTable);
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/VirtualTableManager.cs b/src/ShardingCore/Core/VirtualDatabase/VirtualTables/VirtualTableManager.cs
deleted file mode 100644
index c40ec17b..00000000
--- a/src/ShardingCore/Core/VirtualDatabase/VirtualTables/VirtualTableManager.cs
+++ /dev/null
@@ -1,226 +0,0 @@
-// using System;
-// using System.Collections.Concurrent;
-// using System.Collections.Generic;
-// using System.Linq;
-// using Microsoft.EntityFrameworkCore;
-// using ShardingCore.Core.EntityMetadatas;
-// using ShardingCore.Core.PhysicTables;
-// using ShardingCore.Core.VirtualTables;
-// using ShardingCore.Exceptions;
-// using ShardingCore.Extensions;
-// using ShardingCore.Sharding.Abstractions;
-//
-// namespace ShardingCore.Core.VirtualDatabase.VirtualTables
-// {
-// /*
-// * @Author: xjm
-// * @Description:
-// * @Date: Friday, 18 December 2020 14:52:42
-// * @Email: 326308290@qq.com
-// */
-// ///
-// /// 鍚屼竴涓暟鎹簱涓嬬殑铏氭嫙琛ㄧ鐞嗚
-// ///
-// public class VirtualTableManager : IVirtualTableManager
-// {
-// private readonly IEntityMetadataManager _entityMetadataManager;
-//
-// ///
-// /// {entityType,virtualTableType}
-// ///
-// private readonly ConcurrentDictionary _shardingVirtualTables = new ConcurrentDictionary();
-// public VirtualTableManager(IEntityMetadataManager entityMetadataManager)
-// {
-// _entityMetadataManager = entityMetadataManager;
-// }
-//
-// public bool AddVirtualTable(IVirtualTable virtualTable)
-// {
-// var result = _shardingVirtualTables.TryAdd(virtualTable.EntityMetadata.EntityType, virtualTable);
-// return result;
-// }
-// ///
-// /// 鑾峰彇瀵瑰簲鐨勮櫄鎷熻〃
-// ///
-// ///
-// ///
-// public IVirtualTable GetVirtualTable(Type shardingEntityType)
-// {
-// if (!_entityMetadataManager.IsShardingTable(shardingEntityType))
-// throw new ShardingCoreInvalidOperationException(shardingEntityType.FullName);
-// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
-// throw new ShardingCoreException($"virtual table not found entity: {shardingEntityType.FullName}");
-// return virtualTable;
-// }
-//
-// public IVirtualTable TryGetVirtualTable(Type shardingEntityType)
-// {
-// if (!_entityMetadataManager.IsShardingTable(shardingEntityType))
-// throw new ShardingCoreInvalidOperationException(shardingEntityType.FullName);
-// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
-// return null;
-// return virtualTable;
-// }
-// public ISet GetAllVirtualTables()
-// {
-// return _shardingVirtualTables.Select(o => o.Value).ToHashSet();
-// }
-//
-// public bool AddPhysicTable(IVirtualTable virtualTable, IPhysicTable physicTable)
-// {
-// return AddPhysicTable(virtualTable.EntityMetadata.EntityType, physicTable);
-// }
-//
-// public bool AddPhysicTable(Type shardingEntityType, IPhysicTable physicTable)
-// {
-// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
-// throw new ShardingCoreException($"virtual table not found entity: {shardingEntityType.FullName}");
-// return virtualTable.AddPhysicTable(physicTable);
-// }
-//
-//
-//
-//
-// /////
-// ///// {sharidngDbContextType:{entityType,virtualTableType}}
-// /////
-// //private readonly ConcurrentDictionary> _shardingVirtualTables = new ConcurrentDictionary>();
-// //private readonly ConcurrentDictionary> _shardingVirtualTaleVirtualTables = new ConcurrentDictionary>();
-// //public VirtualTableManager()
-// //{
-//
-// //}
-//
-// //private void CheckShardingDbContextType(Type shardingDbContextType)
-// //{
-// // if (!shardingDbContextType.IsShardingDbContext())
-// // throw new ShardingCoreException(
-// // $"{shardingDbContextType.FullName} must impl {nameof(IShardingDbContext)}");
-// //}
-//
-// //private void CheckShardingTableEntityType(Type shardingEntityType)
-// //{
-// // if (!shardingEntityType.IsShardingTable())
-// // throw new ShardingCoreException(
-// // $"{shardingEntityType.FullName} must impl {nameof(IShardingTable)}");
-// //}
-// //private string CreateShardingEntityTypeKey(Type shardingDbContextType,Type entityType)
-// //{
-// // return $"{shardingDbContextType.FullName}{entityType.FullName}";
-// //}
-// //private string CreateShardingTableNameKey(Type shardingDbContextType,string originalTableName)
-// //{
-// // return $"{shardingDbContextType.FullName}{originalTableName}";
-// //}
-//
-// //public void AddVirtualTable(Type shardingDbContextType,IVirtualTable virtualTable)
-// //{
-// // CheckShardingDbContextType(shardingDbContextType);
-//
-// // var innerShardingVirtualTables = _shardingVirtualTables.GetOrAdd(shardingDbContextType,
-// // key => new ConcurrentDictionary());
-//
-// // if (!innerShardingVirtualTables.ContainsKey(virtualTable.EntityType))
-// // {
-// // innerShardingVirtualTables.TryAdd(virtualTable.EntityType, virtualTable);
-// // }
-//
-// // var innerShardingOriginalTableVirtualTables = _shardingVirtualTaleVirtualTables.GetOrAdd(shardingDbContextType,type=>new ConcurrentDictionary());
-//
-// // if (!innerShardingOriginalTableVirtualTables.ContainsKey(virtualTable.GetVirtualTableName()))
-// // {
-// // innerShardingOriginalTableVirtualTables.TryAdd(virtualTable.GetVirtualTableName(), virtualTable);
-// // }
-// //}
-//
-// //public IVirtualTable GetVirtualTable(Type shardingDbContextType,Type shardingEntityType)
-// //{
-// // CheckShardingDbContextType(shardingDbContextType);
-// // CheckShardingTableEntityType(shardingEntityType);
-//
-// // var shardingKey = CreateShardingEntityTypeKey(shardingDbContextType, shardingEntityType);
-// // if(!_shardingVirtualTables.TryGetValue(shardingDbContextType,out var innerShardingVirtualTables) || innerShardingVirtualTables.IsEmpty())
-// // throw new ShardingVirtualTableNotFoundException(shardingDbContextType.FullName);
-//
-// // if (!innerShardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable)||virtualTable==null)
-// // throw new ShardingVirtualTableNotFoundException(shardingEntityType.FullName);
-// // return virtualTable;
-// //}
-//
-//
-// //public IVirtualTable GetVirtualTable() where T : class, IShardingTable where TDbContext : DbContext, IShardingDbContext
-// //{
-// // return (IVirtualTable)GetVirtualTable(typeof(TDbContext), typeof(T));
-// //}
-//
-// //public IVirtualTable GetVirtualTable(Type shardingDbContextType, string originalTableName)
-// //{
-// // CheckShardingDbContextType(shardingDbContextType);
-// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType, out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
-// // throw new ShardingVirtualTableNotFoundException(shardingDbContextType.FullName);
-// // if(!innerShardingOriginalTableVirtualTables.TryGetValue(originalTableName,out var virtualTable)|| virtualTable==null)
-// // throw new ShardingVirtualTableNotFoundException(originalTableName);
-// // return virtualTable;
-// //}
-//
-// //public IVirtualTable GetVirtualTable(string originalTableName) where TDbContext : DbContext, IShardingDbContext
-// //{
-// // return GetVirtualTable(typeof(TDbContext),originalTableName);
-// //}
-//
-// //public IVirtualTable TryGetVirtualTable(Type shardingDbContextType,string originalTableName)
-// //{
-// // CheckShardingDbContextType(shardingDbContextType);
-// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType,
-// // out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
-// // return null;
-// // if (!innerShardingOriginalTableVirtualTables.TryGetValue(originalTableName, out var virtualTable) || virtualTable == null)
-// // return null;
-// // return virtualTable;
-// //}
-//
-// //public IVirtualTable TryGetVirtualTablee(string originalTableName) where TDbContext : DbContext, IShardingDbContext
-// //{
-// // return TryGetVirtualTable(typeof(TDbContext), originalTableName);
-// //}
-//
-//
-// //public List GetAllVirtualTables(Type shardingDbContextType)
-// //{
-// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType,
-// // out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
-// // return new List();
-// // var keyPrefix = shardingDbContextType.FullName;
-// // return innerShardingOriginalTableVirtualTables.Values.ToList();
-// //}
-//
-// //public List GetAllVirtualTables() where TDbContext : DbContext, IShardingDbContext
-// //{
-// // return GetAllVirtualTables(typeof(TDbContext));
-// //}
-//
-// //public void AddPhysicTable(Type shardingDbContextType,IVirtualTable virtualTable, IPhysicTable physicTable)
-// //{
-// // AddPhysicTable(shardingDbContextType, virtualTable.EntityType, physicTable);
-// //}
-//
-// //public void AddPhysicTable(IVirtualTable virtualTable, IPhysicTable physicTable) where TDbContext : DbContext, IShardingDbContext
-// //{
-// // AddPhysicTable(typeof(TDbContext),virtualTable.EntityType, physicTable);
-// //}
-//
-//
-// //public void AddPhysicTable(Type shardingDbContextType,Type shardingEntityType, IPhysicTable physicTable)
-// //{
-// // var virtualTable = GetVirtualTable(shardingDbContextType,shardingEntityType);
-// // virtualTable.AddPhysicTable(physicTable);
-// //}
-//
-//
-// //public void AddPhysicTable(Type shardingEntityType, IPhysicTable physicTable) where TDbContext : DbContext, IShardingDbContext
-// //{
-// // var virtualTable = GetVirtualTable(typeof(TDbContext),shardingEntityType);
-// // virtualTable.AddPhysicTable(physicTable);
-// //}
-// }
-// }
\ No newline at end of file
diff --git a/src/ShardingCore/Core/VirtualRoutes/Abstractions/ITableRouteManager.cs b/src/ShardingCore/Core/VirtualRoutes/Abstractions/ITableRouteManager.cs
index c3ef0a21..788d2c86 100644
--- a/src/ShardingCore/Core/VirtualRoutes/Abstractions/ITableRouteManager.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/Abstractions/ITableRouteManager.cs
@@ -9,14 +9,48 @@ namespace ShardingCore.Core.VirtualRoutes.Abstractions
public interface ITableRouteManager
{
+ ///
+ /// 瀹炰綋瀵硅薄鏄惁瀛樺湪鍒嗚〃璺敱
+ ///
+ ///
+ ///
bool HasRoute(Type entityType);
+ ///
+ /// 鑾峰彇瀹炰綋瀵硅薄鐨勫垎琛ㄨ矾鐢,濡傛灉娌℃湁灏嗘姏鍑哄紓甯
+ ///
+ ///
+ ///
+ /// 濡傛灉娌℃湁鎵惧埌瀵瑰簲鐨勮矾鐢
IVirtualTableRoute GetRoute(Type entityType);
+ ///
+ /// 鑾峰彇鎵鏈夌殑鍒嗚〃璺敱
+ ///
+ ///
List GetRoutes();
+ ///
+ /// 娣诲姞鍒嗚〃璺敱
+ ///
+ ///
+ ///
+ /// 濡傛灉褰撳墠璺敱鐨勫璞′笉鏄垎琛ㄥ璞″皢鎶涘嚭寮傚父
bool AddRoute(IVirtualTableRoute route);
- List RouteTo(Type entityType,
+ ///
+ /// 鐩存帴璺敱閲囩敤榛樿鏁版嵁婧
+ ///
+ ///
+ ///
+ ///
+ List RouteTo(Type entityType,
ShardingTableRouteConfig shardingTableRouteConfig);
- List RouteTo(Type entityType,DataSourceRouteResult dataSourceRouteResult,
+ ///
+ /// 鏍规嵁鏁版嵁婧愯矾鐢辫繘琛屽垎鐗囪矾鐢
+ ///
+ ///
+ ///
+ ///
+ ///
+ List RouteTo(Type entityType,DataSourceRouteResult dataSourceRouteResult,
ShardingTableRouteConfig shardingTableRouteConfig);
}
}
diff --git a/src/ShardingCore/Core/VirtualRoutes/ShardingRouteUnit.cs b/src/ShardingCore/Core/VirtualRoutes/TableRouteUnit.cs
similarity index 70%
rename from src/ShardingCore/Core/VirtualRoutes/ShardingRouteUnit.cs
rename to src/ShardingCore/Core/VirtualRoutes/TableRouteUnit.cs
index 3b689d05..055ea45a 100644
--- a/src/ShardingCore/Core/VirtualRoutes/ShardingRouteUnit.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRouteUnit.cs
@@ -2,9 +2,9 @@ using System;
namespace ShardingCore.Core.VirtualRoutes
{
- public sealed class ShardingRouteUnit
+ public sealed class TableRouteUnit
{
- public ShardingRouteUnit(string dataSourceName, string tail,Type entityType)
+ public TableRouteUnit(string dataSourceName, string tail,Type entityType)
{
DataSourceName = dataSourceName;
Tail = tail;
@@ -15,14 +15,14 @@ namespace ShardingCore.Core.VirtualRoutes
public string Tail { get;}
public Type EntityType { get; }
- private bool Equals(ShardingRouteUnit other)
+ private bool Equals(TableRouteUnit other)
{
return DataSourceName == other.DataSourceName && Tail == other.Tail && EntityType == other.EntityType;
}
public override bool Equals(object obj)
{
- return ReferenceEquals(this, obj) || obj is ShardingRouteUnit other && Equals(other);
+ return ReferenceEquals(this, obj) || obj is TableRouteUnit other && Equals(other);
}
public override int GetHashCode()
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingFilterVirtualTableRoute.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingFilterVirtualTableRoute.cs
index b9fe346e..5dd275b9 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingFilterVirtualTableRoute.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingFilterVirtualTableRoute.cs
@@ -41,7 +41,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
/// 璺敱鏁版嵁婧愬拰琛ㄥ悗缂杩炴帴绗
///
protected virtual string RouteSeparator => ".";
- public override List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery)
+ public override List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery)
{
if (!isQuery)
{
@@ -59,7 +59,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
if (filterTails.IsEmpty()||filterTails.Count!=mustTails.Count)
throw new ShardingCoreException(
$" sharding route must error:[{EntityMetadata.EntityType.FullName}]-->[{string.Join(",",mustTails)}]");
- var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new ShardingRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
+ var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new TableRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
return shardingRouteUnits;
}
@@ -69,7 +69,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
if (filterTails.IsEmpty()||filterTails.Count!=hintTails.Count)
throw new ShardingCoreException(
$" sharding route hint error:[{EntityMetadata.EntityType.FullName}]-->[{string.Join(",",hintTails)}]");
- var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new ShardingRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
+ var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new TableRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
return GetFilterTableTails(dataSourceRouteResult, shardingRouteUnits);
}
}
@@ -86,7 +86,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
///
///
///
- private List GetFilterTableTails(DataSourceRouteResult dataSourceRouteResult, List shardingRouteUnits)
+ private List GetFilterTableTails(DataSourceRouteResult dataSourceRouteResult, List shardingRouteUnits)
{
if (UseAssertRoute)
{
@@ -106,7 +106,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
out ICollection routeAsserts) &&
routeAsserts.IsNotEmpty();
- private void ProcessAssertRoutes(DataSourceRouteResult dataSourceRouteResult,List shardingRouteUnits)
+ private void ProcessAssertRoutes(DataSourceRouteResult dataSourceRouteResult,List shardingRouteUnits)
{
if (UseAssertRoute)
{
@@ -120,7 +120,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
}
}
- protected abstract List DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable);
+ protected abstract List DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable);
///
@@ -129,7 +129,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
/// 鎵鏈夌殑鏁版嵁婧
/// 鎵鏈夌殑鐗╃悊琛
///
- protected virtual List AfterShardingRouteUnitFilter(DataSourceRouteResult dataSourceRouteResult, List shardingRouteUnits)
+ protected virtual List AfterShardingRouteUnitFilter(DataSourceRouteResult dataSourceRouteResult, List shardingRouteUnits)
{
return shardingRouteUnits;
}
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingOperatorVirtualTableRoute.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingOperatorVirtualTableRoute.cs
index ead0e343..8c5d4533 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingOperatorVirtualTableRoute.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractShardingOperatorVirtualTableRoute.cs
@@ -25,7 +25,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
///
///
///
- protected override List DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable)
+ protected override List DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable)
{
//鑾峰彇璺敱鍚庣紑琛ㄨ揪寮
var routeParseExpression = ShardingUtil.GetRouteParseExpression(queryable, EntityMetadata, GetRouteFilter,true);
@@ -35,7 +35,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
var sqlRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>
GetTails()
.Where(o=>filter(FormatTableRouteWithDataSource(dataSourceName,o)))
- .Select(tail=>new ShardingRouteUnit(dataSourceName,tail,typeof(TEntity)))
+ .Select(tail=>new TableRouteUnit(dataSourceName,tail,typeof(TEntity)))
).ToList();
return sqlRouteUnits;
@@ -71,7 +71,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
throw new NotImplementedException(shardingPropertyName);
}
- public override ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey)
+ public override TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey)
{
if (dataSourceRouteResult.IntersectDataSources.Count !=1)
{
@@ -87,7 +87,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
if (filterTails.Count > 1)
throw new ShardingCoreException($"more than one route match table:{string.Join(",", filterTails)}");
- return new ShardingRouteUnit(dataSourceRouteResult.IntersectDataSources.First(), filterTails[0],typeof(TEntity));
+ return new TableRouteUnit(dataSourceRouteResult.IntersectDataSources.First(), filterTails[0],typeof(TEntity));
}
}
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractVirtualTableRoute.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractVirtualTableRoute.cs
index 59fbe47d..2ff6bcfa 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractVirtualTableRoute.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/Abstractions/AbstractVirtualTableRoute.cs
@@ -69,7 +69,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
///
///
///
- public abstract List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery);
+ public abstract List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery);
///
/// 鏍规嵁鍊艰矾鐢
@@ -77,7 +77,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
///
///
///
- public abstract ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
+ public abstract TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
///
/// 杩斿洖鏁版嵁搴撶幇鏈夌殑灏惧反
///
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/IVirtualTableRoute.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/IVirtualTableRoute.cs
index 1ed6563e..6dfeca94 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/IVirtualTableRoute.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/IVirtualTableRoute.cs
@@ -29,7 +29,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
///
///
///
- List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult,IQueryable queryable,bool isQuery);
+ List RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult,IQueryable queryable,bool isQuery);
///
/// 鏍规嵁鍊艰繘琛岃矾鐢
@@ -37,7 +37,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
///
///
///
- ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
+ TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
///
/// 鑾峰彇鎵鏈夌殑鐩墠鏁版嵁搴撳瓨鍦ㄧ殑灏惧反,浠呭惎鍔ㄦ椂璋冪敤
/// get all tails in the db
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteResult.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteResult.cs
index 65416ee4..9f930472 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteResult.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteResult.cs
@@ -14,17 +14,17 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
*/
public class TableRouteResult
{
- public TableRouteResult(List replaceTables)
+ public TableRouteResult(List replaceTables)
{
ReplaceTables = replaceTables.ToHashSet();
HasDifferentTail = ReplaceTables.IsNotEmpty() && ReplaceTables.GroupBy(o => o.Tail).Count() != 1;
IsEmpty = replaceTables.Count == 0;
}
- public TableRouteResult(ShardingRouteUnit replaceTable):this(new List(){replaceTable})
+ public TableRouteResult(TableRouteUnit replaceTable):this(new List(){replaceTable})
{
}
- public ISet ReplaceTables { get; }
+ public ISet ReplaceTables { get; }
public bool HasDifferentTail { get; }
public bool IsEmpty { get; }
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteRuleEngine.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteRuleEngine.cs
index 30d72012..2b48a32a 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteRuleEngine.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/RoutingRuleEngine/TableRouteRuleEngine.cs
@@ -30,8 +30,8 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
public ShardingRouteResult Route(TableRouteRuleContext tableRouteRuleContext)
{
- Dictionary>> routeMaps =
- new Dictionary>>();
+ Dictionary>> routeMaps =
+ new Dictionary>>();
var queryEntities = tableRouteRuleContext.QueryEntities;
@@ -51,15 +51,15 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
if (!routeMaps.ContainsKey(dataSourceName))
{
routeMaps.Add(dataSourceName,
- new Dictionary>()
- { { shardingEntity, new HashSet() { shardingRouteUnit } } });
+ new Dictionary>()
+ { { shardingEntity, new HashSet() { shardingRouteUnit } } });
}
else
{
var routeMap = routeMaps[dataSourceName];
if (!routeMap.ContainsKey(shardingEntity))
{
- routeMap.Add(shardingEntity, new HashSet() { shardingRouteUnit });
+ routeMap.Add(shardingEntity, new HashSet() { shardingRouteUnit });
}
else
{
diff --git a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/TableRouteManager.cs b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/TableRouteManager.cs
index d14fff8d..2afb9e86 100644
--- a/src/ShardingCore/Core/VirtualRoutes/TableRoutes/TableRouteManager.cs
+++ b/src/ShardingCore/Core/VirtualRoutes/TableRoutes/TableRouteManager.cs
@@ -51,13 +51,14 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
return _tableRoutes.TryAdd(route.EntityMetadata.EntityType, route);
}
- public List RouteTo(Type entityType, ShardingTableRouteConfig shardingTableRouteConfig)
+ public List RouteTo(Type entityType, ShardingTableRouteConfig shardingTableRouteConfig)
{
+
var dataSourceRouteResult = new DataSourceRouteResult(_virtualDataSource.DefaultDataSourceName);
return RouteTo(entityType, dataSourceRouteResult, shardingTableRouteConfig);
}
- public List RouteTo(Type entityType, DataSourceRouteResult dataSourceRouteResult,
+ public List RouteTo(Type entityType, DataSourceRouteResult dataSourceRouteResult,
ShardingTableRouteConfig tableRouteConfig)
{
var route = GetRoute(entityType);
@@ -84,7 +85,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
if (shardingKeyValue == null)
throw new ShardingCoreException(" route entity queryable or sharding key value is null ");
var shardingRouteUnit = route.RouteWithValue(dataSourceRouteResult, shardingKeyValue);
- return new List(1) { shardingRouteUnit };
+ return new List(1) { shardingRouteUnit };
}
}
}
\ No newline at end of file
diff --git a/src/ShardingCore/EFCores/OptionsExtensions/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/OptionsExtensions/ShardingOptionsExtension.cs
index a395bab0..501f65f9 100644
--- a/src/ShardingCore/EFCores/OptionsExtensions/ShardingOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/OptionsExtensions/ShardingOptionsExtension.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
namespace ShardingCore.EFCores.OptionsExtensions
{
diff --git a/src/ShardingCore/EFCores/ShardingInternalDbSet.cs b/src/ShardingCore/EFCores/ShardingInternalDbSet.cs
index 5781bd2f..f21eb84e 100644
--- a/src/ShardingCore/EFCores/ShardingInternalDbSet.cs
+++ b/src/ShardingCore/EFCores/ShardingInternalDbSet.cs
@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Infrastructure;
using ShardingCore.Core.EntityMetadatas;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualRoutes.Abstractions;
using ShardingCore.Extensions;
diff --git a/src/ShardingCore/EFCores/ShardingModelCustomizer.cs b/src/ShardingCore/EFCores/ShardingModelCustomizer.cs
index 19a682ba..0b55d870 100644
--- a/src/ShardingCore/EFCores/ShardingModelCustomizer.cs
+++ b/src/ShardingCore/EFCores/ShardingModelCustomizer.cs
@@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ShardingCore.Core;
using ShardingCore.Core.EntityMetadatas;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
using ShardingCore.Logger;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/EFCores/ShardingQueryCompiler.cs b/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
index 06c60035..a397aff2 100644
--- a/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
+++ b/src/ShardingCore/EFCores/ShardingQueryCompiler.cs
@@ -11,6 +11,7 @@ using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
namespace ShardingCore.EFCores
diff --git a/src/ShardingCore/Extensions/DbContextExtension.cs b/src/ShardingCore/Extensions/DbContextExtension.cs
index 24914846..1457ce6a 100644
--- a/src/ShardingCore/Extensions/DbContextExtension.cs
+++ b/src/ShardingCore/Extensions/DbContextExtension.cs
@@ -15,6 +15,7 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using ShardingCore.Core;
using ShardingCore.Core.EntityMetadatas;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.EFCores;
using ShardingCore.Exceptions;
using ShardingCore.Utils;
diff --git a/src/ShardingCore/Extensions/ShardingDbContextExtension.cs b/src/ShardingCore/Extensions/ShardingDbContextExtension.cs
index 38e763f5..3ffd32f3 100644
--- a/src/ShardingCore/Extensions/ShardingDbContextExtension.cs
+++ b/src/ShardingCore/Extensions/ShardingDbContextExtension.cs
@@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.EFCores.OptionsExtensions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Extensions/ShardingExtension.cs b/src/ShardingCore/Extensions/ShardingExtension.cs
index a5aae53e..51ce7c9a 100644
--- a/src/ShardingCore/Extensions/ShardingExtension.cs
+++ b/src/ShardingCore/Extensions/ShardingExtension.cs
@@ -8,6 +8,7 @@ using System.Text;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
using ShardingCore.Core.VirtualRoutes.TableRoutes;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
diff --git a/src/ShardingCore/Extensions/ShardingReadWriteExtension.cs b/src/ShardingCore/Extensions/ShardingReadWriteExtension.cs
index 066330ab..b890de6d 100644
--- a/src/ShardingCore/Extensions/ShardingReadWriteExtension.cs
+++ b/src/ShardingCore/Extensions/ShardingReadWriteExtension.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using Microsoft.EntityFrameworkCore;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Sharding.Abstractions;
using ShardingCore.Sharding.ReadWriteConfigurations;
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
diff --git a/src/ShardingCore/Helpers/MigrationHelper.cs b/src/ShardingCore/Helpers/MigrationHelper.cs
index 0f2d324a..b19405be 100644
--- a/src/ShardingCore/Helpers/MigrationHelper.cs
+++ b/src/ShardingCore/Helpers/MigrationHelper.cs
@@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Storage;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Extensions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/AsyncTrackerEnumerator.cs b/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/AsyncTrackerEnumerator.cs
index e55a7c8d..8b679174 100644
--- a/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/AsyncTrackerEnumerator.cs
+++ b/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/AsyncTrackerEnumerator.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using ShardingCore.Core;
using ShardingCore.Core.QueryTrackers;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Extensions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/TrackerEnumerator.cs b/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/TrackerEnumerator.cs
index fb1bf495..d4cd46c9 100644
--- a/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/TrackerEnumerator.cs
+++ b/src/ShardingCore/Sharding/Enumerators/TrackerEnumerators/TrackerEnumerator.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using ShardingCore.Core;
using ShardingCore.Core.QueryTrackers;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Extensions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Sharding/MergeEngines/Common/UnSupportSqlRouteUnit.cs b/src/ShardingCore/Sharding/MergeEngines/Common/UnSupportSqlRouteUnit.cs
index 1a4843e8..2b8fdbf2 100644
--- a/src/ShardingCore/Sharding/MergeEngines/Common/UnSupportSqlRouteUnit.cs
+++ b/src/ShardingCore/Sharding/MergeEngines/Common/UnSupportSqlRouteUnit.cs
@@ -15,7 +15,7 @@ namespace ShardingCore.Sharding.MergeEngines.Common
DataSourceName = dataSourceName;
var routeResults = tableRouteResults;
TableRouteResults = routeResults;
- TableRouteResult = new TableRouteResult(new List(0));
+ TableRouteResult = new TableRouteResult(new List(0));
}
public string DataSourceName { get; }
diff --git a/src/ShardingCore/Sharding/ShardingDbContextExecutors/DataSourceDbContext.cs b/src/ShardingCore/Sharding/ShardingDbContextExecutors/DataSourceDbContext.cs
index 4cc5de9a..e8978de7 100644
--- a/src/ShardingCore/Sharding/ShardingDbContextExecutors/DataSourceDbContext.cs
+++ b/src/ShardingCore/Sharding/ShardingDbContextExecutors/DataSourceDbContext.cs
@@ -14,6 +14,7 @@ using ShardingCore.Core;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
using ShardingCore.Core.DbContextCreator;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Exceptions;
using ShardingCore.Extensions;
using ShardingCore.Infrastructures;
diff --git a/src/ShardingCore/Sharding/ShardingDbContextExecutors/ShardingDbContextExecutor.cs b/src/ShardingCore/Sharding/ShardingDbContextExecutors/ShardingDbContextExecutor.cs
index edd089fe..8c3fa53a 100644
--- a/src/ShardingCore/Sharding/ShardingDbContextExecutors/ShardingDbContextExecutor.cs
+++ b/src/ShardingCore/Sharding/ShardingDbContextExecutors/ShardingDbContextExecutor.cs
@@ -11,6 +11,7 @@ using ShardingCore.Core.EntityMetadatas;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
using ShardingCore.Core.DbContextCreator;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualRoutes.Abstractions;
using ShardingCore.Extensions;
using ShardingCore.Sharding.Abstractions;
diff --git a/src/ShardingCore/Sharding/ShardingExecutors/MergeQueryCompilerContext.cs b/src/ShardingCore/Sharding/ShardingExecutors/MergeQueryCompilerContext.cs
index ac573818..35803f3e 100644
--- a/src/ShardingCore/Sharding/ShardingExecutors/MergeQueryCompilerContext.cs
+++ b/src/ShardingCore/Sharding/ShardingExecutors/MergeQueryCompilerContext.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using ShardingCore.Core;
using ShardingCore.Core.EntityMetadatas;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualRoutes;
using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
diff --git a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs
index d6a1380a..daa66130 100644
--- a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs
+++ b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs
@@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Sharding.Parsers;
using ShardingCore.Sharding.Parsers.Abstractions;
diff --git a/src/ShardingCore/Sharding/StreamMergeContext.cs b/src/ShardingCore/Sharding/StreamMergeContext.cs
index ad539335..b29f7992 100644
--- a/src/ShardingCore/Sharding/StreamMergeContext.cs
+++ b/src/ShardingCore/Sharding/StreamMergeContext.cs
@@ -19,6 +19,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Infrastructure;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.VirtualRoutes;
using ShardingCore.Sharding.MergeEngines.Abstractions;
using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
diff --git a/src/ShardingCore/ShardingCore.csproj b/src/ShardingCore/ShardingCore.csproj
index e218517c..e1978835 100644
--- a/src/ShardingCore/ShardingCore.csproj
+++ b/src/ShardingCore/ShardingCore.csproj
@@ -37,7 +37,6 @@
-
diff --git a/src/ShardingCore/ShardingCoreExtension.cs b/src/ShardingCore/ShardingCoreExtension.cs
index 0d2a9fe4..d5116c15 100644
--- a/src/ShardingCore/ShardingCoreExtension.cs
+++ b/src/ShardingCore/ShardingCoreExtension.cs
@@ -29,6 +29,7 @@ using ShardingCore.Bootstrappers;
using ShardingCore.Core;
using ShardingCore.Core.DbContextCreator;
using ShardingCore.Core.QueryTrackers;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.ShardingConfigurations.ConfigBuilders;
using ShardingCore.Core.UnionAllMergeShardingProviders;
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
diff --git a/src/ShardingCore/ShardingRuntimeBuilder.cs b/src/ShardingCore/ShardingRuntimeBuilder.cs
index 6413968c..a76cacea 100644
--- a/src/ShardingCore/ShardingRuntimeBuilder.cs
+++ b/src/ShardingCore/ShardingRuntimeBuilder.cs
@@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ShardingCore.Core;
+using ShardingCore.Core.RuntimeContexts;
using ShardingCore.Core.ShardingConfigurations;
using ShardingCore.Core.ShardingConfigurations.Abstractions;
using ShardingCore.Sharding.Abstractions;