From 4276d23cf390bc7a7fb76e6f24d7e88f80b60056 Mon Sep 17 00:00:00 2001
From: xuejiaming <326308290@qq.com>
Date: Wed, 23 Nov 2022 14:30:07 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=B0=86shardingcore?=
=?UTF-8?q?=E4=BB=8Enet=E4=BE=9D=E8=B5=96=E8=BD=AC=E5=8F=98=E4=B8=BAefcore?=
=?UTF-8?q?=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ShardingCore.sln | 24 +-
.../ShardingCoreBenchmark.csproj | 1 +
.../ShardingCoreBenchmark5x.csproj | 1 +
nuget-publish.bat | 7 +-
.../Sample.AutoCreateIfPresent.csproj | 3 +-
.../Sample.BulkConsole.csproj | 1 +
.../Sample.Migrations.csproj | 3 +-
.../Sample.MultiConfig.csproj | 3 +-
samples/Sample.MySql/Sample.MySql.csproj | 3 +-
.../Sample.NoShardingMultiLevel.csproj | 3 +-
.../Sample.OracleIssue.csproj | 3 +-
.../Sample.ShardingConsole.csproj | 3 +-
.../Sample.SqlServer3x.csproj | 1 +
.../Sample.SqlServerShardingAll.csproj | 3 +-
.../Sample.SqlServerShardingDataSource.csproj | 1 +
.../Sample.SqlServerShardingTable.csproj | 3 +-
.../Samples.AbpSharding.csproj | 3 +-
.../EFCore2x/ScriptMigrationGenerator.cs | 2 +-
.../EFCores/EFCore2x/ShardingChangeTracker.cs | 2 +-
.../EFCores/EFCore2x/ShardingDbSetSource.cs | 2 +-
.../EFCore2x/ShardingInternalDbQuery.cs | 2 +-
.../EFCores/EFCore2x/ShardingInternalDbSet.cs | 2 +-
.../EFCores/EFCore2x/ShardingMigrator.cs | 3 +-
.../EFCores/EFCore2x/ShardingModelSource.cs | 2 +-
.../EFCore2x/ShardingOptionsExtension.cs | 3 +-
.../EFCore2x/ShardingWrapOptionsExtension.cs | 2 +-
.../Tx/ShardingRelationalTransaction.cs | 2 +-
.../ShardingRelationalTransactionFactory.cs | 2 +-
.../ShardingRelationalTransactionManager.cs | 2 +-
.../EFCore2x/UnionAllMergeOptionsExtension.cs | 2 +-
.../EFCore3x/ScriptMigrationGenerator.cs | 2 +-
.../EFCores/EFCore3x/ShardingChangeTracker.cs | 2 +-
.../EFCores/EFCore3x/ShardingDbSetSource.cs | 2 +-
.../EFCores/EFCore3x/ShardingInternalDbSet.cs | 2 +-
.../EFCores/EFCore3x/ShardingMigrator.cs | 3 +-
.../EFCores/EFCore3x/ShardingModelSource.cs | 2 +-
.../EFCore3x/ShardingOptionsExtension.cs | 2 +-
.../EFCore3x/ShardingWrapOptionsExtension.cs | 2 +-
.../Tx/ShardingRelationalTransaction.cs | 2 +-
.../ShardingRelationalTransactionFactory.cs | 2 +-
.../ShardingRelationalTransactionManager.cs | 2 +-
.../EFCore3x/UnionAllMergeOptionsExtension.cs | 2 +-
.../EFCore5x/ScriptMigrationGenerator.cs | 2 +-
.../EFCores/EFCore5x/ShardingChangeTracker.cs | 2 +-
.../EFCores/EFCore5x/ShardingDbSetSource.cs | 2 +-
.../EFCores/EFCore5x/ShardingInternalDbSet.cs | 2 +-
.../EFCores/EFCore5x/ShardingMigrator.cs | 3 +-
.../EFCores/EFCore5x/ShardingModelSource.cs | 2 +-
.../EFCore5x/ShardingOptionsExtension.cs | 2 +-
.../EFCore5x/ShardingWrapOptionsExtension.cs | 2 +-
.../Tx/ShardingRelationalTransaction.cs | 2 +-
.../ShardingRelationalTransactionFactory.cs | 2 +-
.../ShardingRelationalTransactionManager.cs | 3 +-
.../EFCore5x/UnionAllMergeOptionsExtension.cs | 2 +-
.../EFCore6x/ScriptMigrationGenerator.cs | 2 +-
.../EFCores/EFCore6x/ShardingChangeTracker.cs | 2 +-
.../EFCores/EFCore6x/ShardingDbSetSource.cs | 2 +-
.../EFCores/EFCore6x/ShardingInternalDbSet.cs | 2 +-
.../EFCores/EFCore6x/ShardingMigrator.cs | 3 +-
.../EFCores/EFCore6x/ShardingModelSource.cs | 3 +-
.../EFCore6x/ShardingOptionsExtension.cs | 2 +-
.../EFCore6x/ShardingWrapOptionsExtension.cs | 2 +-
.../Tx/ShardingRelationalTransaction.cs | 2 +-
.../ShardingRelationalTransactionFactory.cs | 2 +-
.../ShardingRelationalTransactionManager.cs | 2 +-
.../EFCore6x/UnionAllMergeOptionsExtension.cs | 2 +-
...r2_6.cs => ShardingQueryPrepareVisitor.cs} | 21 +-
.../Visitors/ShardingQueryPrepareVisitor7.cs | 219 ------------------
src/ShardingCore/Utils/ShardingUtil.cs | 1 -
.../ShardingCore.2_6/ShardingCore.2_6.csproj | 98 --------
.../ShardingCore.Test2x.csproj | 1 +
.../ShardingCore.Test3x.csproj | 1 +
.../ShardingCore.Test5x.csproj | 1 +
.../ShardingCore.Test6x.csproj | 3 +-
74 files changed, 99 insertions(+), 417 deletions(-)
rename src/ShardingCore/Sharding/Parsers/Visitors/{ShardingQueryPrepareVisitor2_6.cs => ShardingQueryPrepareVisitor.cs} (95%)
delete mode 100644 src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor7.cs
delete mode 100644 src2_6/ShardingCore.2_6/ShardingCore.2_6.csproj
diff --git a/ShardingCore.sln b/ShardingCore.sln
index f1a9460d..2481fe62 100644
--- a/ShardingCore.sln
+++ b/ShardingCore.sln
@@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{EDF8
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.SqlServer", "samples\Sample.SqlServer\Sample.SqlServer.csproj", "{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AutoByDate.SqlServer", "samples\Samples.AutoByDate.SqlServer\Samples.AutoByDate.SqlServer.csproj", "{C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.MySql", "samples\Sample.MySql\Sample.MySql.csproj", "{90675788-D5C3-415A-9C18-FF159A75B4D5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.SqlServer3x", "samples\Sample.SqlServer3x\Sample.SqlServer3x.csproj", "{447D5357-F095-45DE-9DA5-2D9997237366}"
@@ -57,10 +55,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.ShardingConsole", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.OracleIssue", "samples\Sample.OracleIssue\Sample.OracleIssue.csproj", "{BF4FEA2A-3F09-47D8-9BF7-4261D8D1671D}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src2_6", "src2_6", "{5C015EB7-678C-421E-BB84-30EDCCCE0AB6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore.2_6", "src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj", "{B8B27249-E775-4A8F-BF64-B64C6B34DAA3}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore.Test6x", "test\ShardingCore.Test6x\ShardingCore.Test6x.csproj", "{8ED3A191-5A29-4599-B383-9FD225CC0BA2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src6", "src6", "{585A790B-8B19-430F-BEB7-9F7D1A3AAFAA}"
@@ -71,13 +65,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src2", "src2", "{B11D7DF7-A
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src3", "src3", "{51E1D067-3E81-4815-94F2-F8ABBE80881E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore6", "src6\ShardingCore6\ShardingCore6.csproj", "{3F80E6C2-D0AB-409D-B200-FFB6620E956A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore6", "src6\ShardingCore6\ShardingCore6.csproj", "{3F80E6C2-D0AB-409D-B200-FFB6620E956A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore5", "src5\ShardingCore5\ShardingCore5.csproj", "{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore5", "src5\ShardingCore5\ShardingCore5.csproj", "{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore3", "src3\ShardingCore3\ShardingCore3.csproj", "{B59909AD-8885-40F3-9454-6C8433463BCC}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore3", "src3\ShardingCore3\ShardingCore3.csproj", "{B59909AD-8885-40F3-9454-6C8433463BCC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore2", "src2\ShardingCore2\ShardingCore2.csproj", "{F0393C32-2285-4F47-AC61-C1BA1CAC269D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShardingCore2", "src2\ShardingCore2\ShardingCore2.csproj", "{F0393C32-2285-4F47-AC61-C1BA1CAC269D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -93,10 +87,6 @@ Global
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F}.Release|Any CPU.Build.0 = Release|Any CPU
- {C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C34FCF48-1A98-4268-BFEE-6C9BFC7FD539}.Release|Any CPU.Build.0 = Release|Any CPU
{90675788-D5C3-415A-9C18-FF159A75B4D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90675788-D5C3-415A-9C18-FF159A75B4D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90675788-D5C3-415A-9C18-FF159A75B4D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -177,10 +167,6 @@ Global
{BF4FEA2A-3F09-47D8-9BF7-4261D8D1671D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF4FEA2A-3F09-47D8-9BF7-4261D8D1671D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF4FEA2A-3F09-47D8-9BF7-4261D8D1671D}.Release|Any CPU.Build.0 = Release|Any CPU
- {B8B27249-E775-4A8F-BF64-B64C6B34DAA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8B27249-E775-4A8F-BF64-B64C6B34DAA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B8B27249-E775-4A8F-BF64-B64C6B34DAA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8B27249-E775-4A8F-BF64-B64C6B34DAA3}.Release|Any CPU.Build.0 = Release|Any CPU
{8ED3A191-5A29-4599-B383-9FD225CC0BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8ED3A191-5A29-4599-B383-9FD225CC0BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8ED3A191-5A29-4599-B383-9FD225CC0BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -208,7 +194,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{3CAF09A6-6ABD-41D9-BA57-9A822B8095F7} = {490FAE47-4476-4508-B216-505FC850447F}
{D48E5EC2-CF83-4B17-8BBA-BDE52ADFAB1F} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
- {C34FCF48-1A98-4268-BFEE-6C9BFC7FD539} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
{90675788-D5C3-415A-9C18-FF159A75B4D5} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
{447D5357-F095-45DE-9DA5-2D9997237366} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
{1136B8C9-3539-42FA-97FD-CAA6F146FCF0} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
@@ -229,7 +214,6 @@ Global
{3E895438-E609-4860-8391-6897ED55DA06} = {CC2C88C0-65F2-445D-BE78-973B840FE281}
{BAB101D4-2BFF-44CE-90E3-8B72DDB266B8} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
{BF4FEA2A-3F09-47D8-9BF7-4261D8D1671D} = {EDF8869A-C1E1-491B-BC9F-4A33F4DE1C73}
- {B8B27249-E775-4A8F-BF64-B64C6B34DAA3} = {5C015EB7-678C-421E-BB84-30EDCCCE0AB6}
{8ED3A191-5A29-4599-B383-9FD225CC0BA2} = {CC2C88C0-65F2-445D-BE78-973B840FE281}
{3F80E6C2-D0AB-409D-B200-FFB6620E956A} = {585A790B-8B19-430F-BEB7-9F7D1A3AAFAA}
{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D} = {53D07876-A791-46AE-8381-08557593693D}
diff --git a/benchmarks/ShardingCoreBenchmark/ShardingCoreBenchmark.csproj b/benchmarks/ShardingCoreBenchmark/ShardingCoreBenchmark.csproj
index 5e8de405..e75f0219 100644
--- a/benchmarks/ShardingCoreBenchmark/ShardingCoreBenchmark.csproj
+++ b/benchmarks/ShardingCoreBenchmark/ShardingCoreBenchmark.csproj
@@ -18,6 +18,7 @@
+
diff --git a/benchmarks/ShardingCoreBenchmark5x/ShardingCoreBenchmark5x.csproj b/benchmarks/ShardingCoreBenchmark5x/ShardingCoreBenchmark5x.csproj
index 3cdc6e75..2db8b2be 100644
--- a/benchmarks/ShardingCoreBenchmark5x/ShardingCoreBenchmark5x.csproj
+++ b/benchmarks/ShardingCoreBenchmark5x/ShardingCoreBenchmark5x.csproj
@@ -13,6 +13,7 @@
+
diff --git a/nuget-publish.bat b/nuget-publish.bat
index c920ad76..a2c07806 100644
--- a/nuget-publish.bat
+++ b/nuget-publish.bat
@@ -1,7 +1,10 @@
:start
::定义版本
-set SHARDINGCORE7=7.0.0.5
-set SHARDINGCORE2_6=6.8.0.9
+set EFCORE7=7.7.0.6
+set EFCORE6=7.6.0.6
+set EFCORE5=7.5.0.6
+set EFCORE3=7.3.0.6
+set EFCORE2=7.2.0.6
::删除所有bin与obj下的文件
@echo off
diff --git a/samples/Sample.AutoCreateIfPresent/Sample.AutoCreateIfPresent.csproj b/samples/Sample.AutoCreateIfPresent/Sample.AutoCreateIfPresent.csproj
index 128682ae..758a889a 100644
--- a/samples/Sample.AutoCreateIfPresent/Sample.AutoCreateIfPresent.csproj
+++ b/samples/Sample.AutoCreateIfPresent/Sample.AutoCreateIfPresent.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -14,6 +14,7 @@
+
diff --git a/samples/Sample.BulkConsole/Sample.BulkConsole.csproj b/samples/Sample.BulkConsole/Sample.BulkConsole.csproj
index c4f054d1..8ed51161 100644
--- a/samples/Sample.BulkConsole/Sample.BulkConsole.csproj
+++ b/samples/Sample.BulkConsole/Sample.BulkConsole.csproj
@@ -11,6 +11,7 @@
+
diff --git a/samples/Sample.Migrations/Sample.Migrations.csproj b/samples/Sample.Migrations/Sample.Migrations.csproj
index bcaeb1ae..35d4cee7 100644
--- a/samples/Sample.Migrations/Sample.Migrations.csproj
+++ b/samples/Sample.Migrations/Sample.Migrations.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -14,6 +14,7 @@
+
diff --git a/samples/Sample.MultiConfig/Sample.MultiConfig.csproj b/samples/Sample.MultiConfig/Sample.MultiConfig.csproj
index f384fd36..9527c7c8 100644
--- a/samples/Sample.MultiConfig/Sample.MultiConfig.csproj
+++ b/samples/Sample.MultiConfig/Sample.MultiConfig.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -13,6 +13,7 @@
+
diff --git a/samples/Sample.MySql/Sample.MySql.csproj b/samples/Sample.MySql/Sample.MySql.csproj
index 8c24e2c5..311f1cb3 100644
--- a/samples/Sample.MySql/Sample.MySql.csproj
+++ b/samples/Sample.MySql/Sample.MySql.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -17,6 +17,7 @@
+
diff --git a/samples/Sample.NoShardingMultiLevel/Sample.NoShardingMultiLevel.csproj b/samples/Sample.NoShardingMultiLevel/Sample.NoShardingMultiLevel.csproj
index 4fdafaa8..02b7dc9a 100644
--- a/samples/Sample.NoShardingMultiLevel/Sample.NoShardingMultiLevel.csproj
+++ b/samples/Sample.NoShardingMultiLevel/Sample.NoShardingMultiLevel.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -12,6 +12,7 @@
+
diff --git a/samples/Sample.OracleIssue/Sample.OracleIssue.csproj b/samples/Sample.OracleIssue/Sample.OracleIssue.csproj
index 52b19498..505d51d4 100644
--- a/samples/Sample.OracleIssue/Sample.OracleIssue.csproj
+++ b/samples/Sample.OracleIssue/Sample.OracleIssue.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -16,6 +16,7 @@
+
diff --git a/samples/Sample.ShardingConsole/Sample.ShardingConsole.csproj b/samples/Sample.ShardingConsole/Sample.ShardingConsole.csproj
index be9b0f53..bde25268 100644
--- a/samples/Sample.ShardingConsole/Sample.ShardingConsole.csproj
+++ b/samples/Sample.ShardingConsole/Sample.ShardingConsole.csproj
@@ -1,4 +1,4 @@
-
+
Exe
@@ -9,6 +9,7 @@
+
diff --git a/samples/Sample.SqlServer3x/Sample.SqlServer3x.csproj b/samples/Sample.SqlServer3x/Sample.SqlServer3x.csproj
index 19dde831..420f0709 100644
--- a/samples/Sample.SqlServer3x/Sample.SqlServer3x.csproj
+++ b/samples/Sample.SqlServer3x/Sample.SqlServer3x.csproj
@@ -10,6 +10,7 @@
+
diff --git a/samples/Sample.SqlServerShardingAll/Sample.SqlServerShardingAll.csproj b/samples/Sample.SqlServerShardingAll/Sample.SqlServerShardingAll.csproj
index 9517e637..2023143b 100644
--- a/samples/Sample.SqlServerShardingAll/Sample.SqlServerShardingAll.csproj
+++ b/samples/Sample.SqlServerShardingAll/Sample.SqlServerShardingAll.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -10,6 +10,7 @@
+
diff --git a/samples/Sample.SqlServerShardingDataSource/Sample.SqlServerShardingDataSource.csproj b/samples/Sample.SqlServerShardingDataSource/Sample.SqlServerShardingDataSource.csproj
index 19fa28ac..05344e28 100644
--- a/samples/Sample.SqlServerShardingDataSource/Sample.SqlServerShardingDataSource.csproj
+++ b/samples/Sample.SqlServerShardingDataSource/Sample.SqlServerShardingDataSource.csproj
@@ -12,6 +12,7 @@
+
diff --git a/samples/Sample.SqlServerShardingTable/Sample.SqlServerShardingTable.csproj b/samples/Sample.SqlServerShardingTable/Sample.SqlServerShardingTable.csproj
index 9517e637..2023143b 100644
--- a/samples/Sample.SqlServerShardingTable/Sample.SqlServerShardingTable.csproj
+++ b/samples/Sample.SqlServerShardingTable/Sample.SqlServerShardingTable.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -10,6 +10,7 @@
+
diff --git a/samples/Samples.AbpSharding/Samples.AbpSharding.csproj b/samples/Samples.AbpSharding/Samples.AbpSharding.csproj
index 87474750..6162197f 100644
--- a/samples/Samples.AbpSharding/Samples.AbpSharding.csproj
+++ b/samples/Samples.AbpSharding/Samples.AbpSharding.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -12,6 +12,7 @@
+
diff --git a/src/ShardingCore/EFCores/EFCore2x/ScriptMigrationGenerator.cs b/src/ShardingCore/EFCores/EFCore2x/ScriptMigrationGenerator.cs
index 28c9d408..e208f033 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ScriptMigrationGenerator.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ScriptMigrationGenerator.cs
@@ -1,4 +1,4 @@
-#if EFCORE2&&SHARDINGCORE2_6
+#if EFCORE2
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingChangeTracker.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingChangeTracker.cs
index 7f4dff30..34075184 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingChangeTracker.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingChangeTracker.cs
@@ -1,4 +1,4 @@
-#if EFCORE2&&SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingDbSetSource.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingDbSetSource.cs
index 57e3fcdb..b12f8c59 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingDbSetSource.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingDbSetSource.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbQuery.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbQuery.cs
index a1549e67..37aca469 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbQuery.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbQuery.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbSet.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbSet.cs
index b1b7ee19..039fe3ba 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbSet.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingInternalDbSet.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingMigrator.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingMigrator.cs
index ab940050..0d0a36a0 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingMigrator.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingMigrator.cs
@@ -1,5 +1,4 @@
-
-#if EFCORE2&&SHARDINGCORE2_6
+#if EFCORE2
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingModelSource.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingModelSource.cs
index 76642315..f95aaefe 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingModelSource.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingModelSource.cs
@@ -1,4 +1,4 @@
-#if EFCORE2&&SHARDINGCORE2_6
+#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingOptionsExtension.cs
index ca99b319..d69e89b9 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingOptionsExtension.cs
@@ -1,5 +1,4 @@
-
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
diff --git a/src/ShardingCore/EFCores/EFCore2x/ShardingWrapOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore2x/ShardingWrapOptionsExtension.cs
index 36a84b86..0cb0d849 100644
--- a/src/ShardingCore/EFCores/EFCore2x/ShardingWrapOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/ShardingWrapOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransaction.cs
index 66acbe37..33a5c45d 100644
--- a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransaction.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransaction.cs
@@ -1,4 +1,4 @@
-#if EFCORE2&&SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionFactory.cs b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionFactory.cs
index 0f93d953..3e146823 100644
--- a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionFactory.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionFactory.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionManager.cs b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionManager.cs
index 2b33517f..5daf7a61 100644
--- a/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionManager.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/Tx/ShardingRelationalTransactionManager.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data;
diff --git a/src/ShardingCore/EFCores/EFCore2x/UnionAllMergeOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore2x/UnionAllMergeOptionsExtension.cs
index 669c7887..9e023550 100644
--- a/src/ShardingCore/EFCores/EFCore2x/UnionAllMergeOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore2x/UnionAllMergeOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if EFCORE2 && SHARDINGCORE2_6
+#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ScriptMigrationGenerator.cs b/src/ShardingCore/EFCores/EFCore3x/ScriptMigrationGenerator.cs
index 01e02a19..3ff2b427 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ScriptMigrationGenerator.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ScriptMigrationGenerator.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
+#if EFCORE3
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingChangeTracker.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingChangeTracker.cs
index ae638799..402a5e84 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingChangeTracker.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingChangeTracker.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingDbSetSource.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingDbSetSource.cs
index 3d235346..1dcfbe53 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingDbSetSource.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingDbSetSource.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingInternalDbSet.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingInternalDbSet.cs
index 0c9371c8..6b04618d 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingInternalDbSet.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingInternalDbSet.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingMigrator.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingMigrator.cs
index 769f862b..cba48d18 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingMigrator.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingMigrator.cs
@@ -1,5 +1,4 @@
-
-#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
+#if EFCORE3
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingModelSource.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingModelSource.cs
index a1de0d28..c1d11789 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingModelSource.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingModelSource.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingOptionsExtension.cs
index a9cc4fcb..d4d4ac4a 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
diff --git a/src/ShardingCore/EFCores/EFCore3x/ShardingWrapOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore3x/ShardingWrapOptionsExtension.cs
index bdc6c5c9..e9c02044 100644
--- a/src/ShardingCore/EFCores/EFCore3x/ShardingWrapOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/ShardingWrapOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransaction.cs
index e06ce840..7bd5c49d 100644
--- a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransaction.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransaction.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionFactory.cs b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionFactory.cs
index 1d194f13..e93b616b 100644
--- a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionFactory.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionFactory.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionManager.cs b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionManager.cs
index 5303c45c..b812fe7c 100644
--- a/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionManager.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/Tx/ShardingRelationalTransactionManager.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data;
diff --git a/src/ShardingCore/EFCores/EFCore3x/UnionAllMergeOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore3x/UnionAllMergeOptionsExtension.cs
index cf92d6b3..71f86c85 100644
--- a/src/ShardingCore/EFCores/EFCore3x/UnionAllMergeOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore3x/UnionAllMergeOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
+#if EFCORE3
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ScriptMigrationGenerator.cs b/src/ShardingCore/EFCores/EFCore5x/ScriptMigrationGenerator.cs
index 36e8be8a..8dd16a21 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ScriptMigrationGenerator.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ScriptMigrationGenerator.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
+#if EFCORE5
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingChangeTracker.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingChangeTracker.cs
index adfb2aa5..fce94d2a 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingChangeTracker.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingChangeTracker.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingDbSetSource.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingDbSetSource.cs
index 49ab89e0..765dfa80 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingDbSetSource.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingDbSetSource.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
+#if EFCORE5
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingInternalDbSet.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingInternalDbSet.cs
index 78279050..6f11210b 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingInternalDbSet.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingInternalDbSet.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
+#if EFCORE5
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingMigrator.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingMigrator.cs
index 4fb9ba02..1d25d1ba 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingMigrator.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingMigrator.cs
@@ -1,5 +1,4 @@
-
-#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
+#if EFCORE5
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingModelSource.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingModelSource.cs
index 3f11238f..e841336e 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingModelSource.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingModelSource.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingOptionsExtension.cs
index 17a2227f..3dfbcc78 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
diff --git a/src/ShardingCore/EFCores/EFCore5x/ShardingWrapOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore5x/ShardingWrapOptionsExtension.cs
index ccd4d12b..c223f7a0 100644
--- a/src/ShardingCore/EFCores/EFCore5x/ShardingWrapOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/ShardingWrapOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransaction.cs
index 7536721a..d6badcab 100644
--- a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransaction.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransaction.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionFactory.cs b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionFactory.cs
index 03c0149f..596f75e3 100644
--- a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionFactory.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionFactory.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionManager.cs b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionManager.cs
index d63d91b8..85ad6ac3 100644
--- a/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionManager.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/Tx/ShardingRelationalTransactionManager.cs
@@ -1,5 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
-
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data;
diff --git a/src/ShardingCore/EFCores/EFCore5x/UnionAllMergeOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore5x/UnionAllMergeOptionsExtension.cs
index f4377528..43c2e206 100644
--- a/src/ShardingCore/EFCores/EFCore5x/UnionAllMergeOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore5x/UnionAllMergeOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
+#if EFCORE5
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ScriptMigrationGenerator.cs b/src/ShardingCore/EFCores/EFCore6x/ScriptMigrationGenerator.cs
index ccb6bae1..ef7d1ae5 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ScriptMigrationGenerator.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ScriptMigrationGenerator.cs
@@ -1,4 +1,4 @@
-#if EFCORE6&&SHARDINGCORE2_6
+#if EFCORE6
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingChangeTracker.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingChangeTracker.cs
index 6840f855..7587b870 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingChangeTracker.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingChangeTracker.cs
@@ -1,4 +1,4 @@
-#if EFCORE6&&SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingDbSetSource.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingDbSetSource.cs
index d4db4bda..2cea7146 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingDbSetSource.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingDbSetSource.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingInternalDbSet.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingInternalDbSet.cs
index 70768135..e95d1891 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingInternalDbSet.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingInternalDbSet.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingMigrator.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingMigrator.cs
index d475a2c1..b4a32645 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingMigrator.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingMigrator.cs
@@ -1,5 +1,4 @@
-
-#if EFCORE6&&SHARDINGCORE2_6
+#if EFCORE6
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingModelSource.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingModelSource.cs
index d0950ae4..503d5d7b 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingModelSource.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingModelSource.cs
@@ -1,5 +1,4 @@
-
-#if EFCORE6&&SHARDINGCORE2_6
+#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingOptionsExtension.cs
index ff11fc66..9e502334 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
diff --git a/src/ShardingCore/EFCores/EFCore6x/ShardingWrapOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore6x/ShardingWrapOptionsExtension.cs
index 8e6ddf73..2ccc10cf 100644
--- a/src/ShardingCore/EFCores/EFCore6x/ShardingWrapOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/ShardingWrapOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransaction.cs
index b6d9cde4..eb8a6685 100644
--- a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransaction.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransaction.cs
@@ -1,4 +1,4 @@
-#if EFCORE6&&SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionFactory.cs b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionFactory.cs
index c1461807..6bb9862d 100644
--- a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionFactory.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionFactory.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using System.Data.Common;
diff --git a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionManager.cs b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionManager.cs
index 12c869eb..9d32ff38 100644
--- a/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionManager.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/Tx/ShardingRelationalTransactionManager.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
diff --git a/src/ShardingCore/EFCores/EFCore6x/UnionAllMergeOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore6x/UnionAllMergeOptionsExtension.cs
index 4f6b78bf..1cbb12bf 100644
--- a/src/ShardingCore/EFCores/EFCore6x/UnionAllMergeOptionsExtension.cs
+++ b/src/ShardingCore/EFCores/EFCore6x/UnionAllMergeOptionsExtension.cs
@@ -1,4 +1,4 @@
-#if EFCORE6 && SHARDINGCORE2_6
+#if EFCORE6
using System;
using System.Collections.Generic;
using System.Text;
diff --git a/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor2_6.cs b/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor.cs
similarity index 95%
rename from src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor2_6.cs
rename to src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor.cs
index 4f14c9ba..6f7fd1bc 100644
--- a/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor2_6.cs
+++ b/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor.cs
@@ -1,5 +1,4 @@
-#if SHARDINGCORE2_6
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -43,7 +42,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
public ShardingQueryPrepareVisitor(IShardingDbContext shardingDbContext)
{
_shardingDbContext = shardingDbContext;
- _trackerManager =((DbContext)shardingDbContext).GetShardingRuntimeContext()
+ _trackerManager = ((DbContext)shardingDbContext).GetShardingRuntimeContext()
.GetTrackerManager();
}
public ShardingPrepareResult GetShardingPrepareResult()
@@ -55,7 +54,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
shardingQueryableAsSequenceOptions,
shardingEntities, isNoTracking, isIgnoreFilter);
}
-#if EFCORE2 || NETSTANDARD2_0 || EFCORE3
+#if EFCORE2 || EFCORE3
protected override Expression VisitConstant(ConstantExpression node)
{
if (node.Value is IQueryable queryable)
@@ -66,18 +65,22 @@ namespace ShardingCore.Sharding.Parsers.Visitors
return base.VisitConstant(node);
}
#endif
-#if EFCORE5 || NETSTANDARD2_1 || EFCORE6
+#if EFCORE5 || EFCORE6 || EFCORE7
protected override Expression VisitExtension(Expression node)
{
if (node is QueryRootExpression queryRootExpression)
{
+#if EFCORE7
+ TryAddShardingEntities(queryRootExpression.ElementType, null);
+#else
TryAddShardingEntities(queryRootExpression.EntityType.ClrType, null);
+#endif
}
return base.VisitExtension(node);
}
#endif
- private void TryAddShardingEntities(Type entityType, IQueryable queryable)
+ private void TryAddShardingEntities(Type entityType, IQueryable queryable)
{
if (!shardingEntities.ContainsKey(entityType))
{
@@ -133,7 +136,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
// case nameof(EntityFrameworkQueryableExtensions.ThenInclude): DiscoverQueryEntities(node); break;
default:
{
- if (node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType)
+ if (node.Method.ReturnType.IsMethodReturnTypeQueryableType() && node.Method.ReturnType.IsGenericType)
{
DiscoverQueryEntities(node);
}
@@ -202,7 +205,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
for (var i = 0; i < genericArguments.Length; i++)
{
var genericArgument = genericArguments[i];
-
+
if (typeof(IEnumerable).IsAssignableFrom(genericArgument))
{
var arguments = genericArgument.GetGenericArguments();
@@ -230,5 +233,3 @@ namespace ShardingCore.Sharding.Parsers.Visitors
}
}
-
-#endif
\ No newline at end of file
diff --git a/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor7.cs b/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor7.cs
deleted file mode 100644
index 31f40545..00000000
--- a/src/ShardingCore/Sharding/Parsers/Visitors/ShardingQueryPrepareVisitor7.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-#if EFCORE7
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Query;
-using ShardingCore.Core;
-using ShardingCore.Core.TrackerManagers;
-using ShardingCore.Extensions;
-using ShardingCore.Extensions.ShardingQueryableExtensions;
-using ShardingCore.Sharding.Abstractions;
-using ShardingCore.Sharding.Visitors.ShardingExtractParameters;
-
-namespace ShardingCore.Sharding.Parsers.Visitors
-{
- ///
- ///
- ///
- /// Author: xjm
- /// Created: 2022/5/1 21:43:12
- /// Email: 326308290@qq.com
- internal class ShardingQueryPrepareVisitor : ExpressionVisitor
- {
- private readonly IShardingDbContext _shardingDbContext;
- private bool isNotSupport;
- private ShardingQueryableUseConnectionModeOptions shardingQueryableUseConnectionModeOptions;
- private ShardingQueryableAsRouteOptions shardingQueryableAsRouteOptions;
- private ShardingQueryableReadWriteSeparationOptions shardingQueryableReadWriteSeparationOptions;
- private ShardingQueryableAsSequenceOptions shardingQueryableAsSequenceOptions;
-
-
-
- private readonly ITrackerManager _trackerManager;
- private bool? isNoTracking;
- private bool isIgnoreFilter;
- private readonly Dictionary shardingEntities = new();
-
- public ShardingQueryPrepareVisitor(IShardingDbContext shardingDbContext)
- {
- _shardingDbContext = shardingDbContext;
- _trackerManager =((DbContext)shardingDbContext).GetShardingRuntimeContext()
- .GetTrackerManager();
- }
- public ShardingPrepareResult GetShardingPrepareResult()
- {
- return new ShardingPrepareResult(isNotSupport,
- shardingQueryableAsRouteOptions,
- shardingQueryableUseConnectionModeOptions,
- shardingQueryableReadWriteSeparationOptions,
- shardingQueryableAsSequenceOptions,
- shardingEntities, isNoTracking, isIgnoreFilter);
- }
- protected override Expression VisitExtension(Expression node)
- {
- if (node is QueryRootExpression queryRootExpression)
- {
- TryAddShardingEntities(queryRootExpression.ElementType, null);
- }
- return base.VisitExtension(node);
- }
- private void TryAddShardingEntities(Type entityType, IQueryable queryable)
- {
- if (!shardingEntities.ContainsKey(entityType))
- {
- shardingEntities.Add(entityType, queryable);
- }
- }
-
- protected override Expression VisitMember
- (MemberExpression memberExpression)
- {
-
- //if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
- //{
- // Recurse down to see if we can simplify...
- var expression = Visit(memberExpression.Expression);
-
- // If we've ended up with a constant, and it's a property or a field,
- // we can simplify ourselves to a constant
- if (expression is ConstantExpression)
- {
- object container = ((ConstantExpression)expression).Value;
- var member = memberExpression.Member;
- if (member is FieldInfo fieldInfo)
- {
- object value = fieldInfo.GetValue(container);
- if (value is IQueryable queryable)
- {
- TryAddShardingEntities(queryable.ElementType, queryable);
- }
- //return Expression.Constant(value);
- }
- if (member is PropertyInfo propertyInfo)
- {
- object value = propertyInfo.GetValue(container, null);
- if (value is IQueryable queryable)
- {
- TryAddShardingEntities(queryable.ElementType, queryable);
- }
- }
- }
- //}
- return base.VisitMember(memberExpression);
- }
- protected override Expression VisitMethodCall(MethodCallExpression node)
- {
-
- switch (node.Method.Name)
- {
- case nameof(EntityFrameworkQueryableExtensions.AsNoTracking): isNoTracking = true; break;
- case nameof(EntityFrameworkQueryableExtensions.AsTracking): isNoTracking = false; break;
- case nameof(EntityFrameworkQueryableExtensions.IgnoreQueryFilters): isIgnoreFilter = true; break;
- // case nameof(EntityFrameworkQueryableExtensions.Include):
- // case nameof(EntityFrameworkQueryableExtensions.ThenInclude): DiscoverQueryEntities(node); break;
- default:
- {
- if (node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType)
- {
- DiscoverQueryEntities(node);
- }
- var customerExpression = DiscoverCustomerQueryEntities(node);
- if (customerExpression != null)
- {
- return Visit(customerExpression);
- }
- }
- ; break;
- }
-
-
- return base.VisitMethodCall(node);
- }
-
- private Expression DiscoverCustomerQueryEntities(MethodCallExpression node)
- {
-
- if (node.Method.IsGenericMethod)
- {
- var genericMethodDefinition = node.Method.GetGenericMethodDefinition();
-
- // find notsupport extention calls
- if (genericMethodDefinition == EntityFrameworkShardingQueryableExtension.NotSupportMethodInfo)
- {
- isNotSupport = true;
- // cut out extension expression
- return node.Arguments[0];
- }
- else if (genericMethodDefinition == EntityFrameworkShardingQueryableExtension.UseConnectionModeMethodInfo)
- {
- shardingQueryableUseConnectionModeOptions = node.Arguments
- .OfType()
- .Where(o => o.Value is ShardingQueryableUseConnectionModeOptions)
- .Select(o => (ShardingQueryableUseConnectionModeOptions)o.Value)
- .Last();
- return node.Arguments[0];
- }
- else if (genericMethodDefinition == EntityFrameworkShardingQueryableExtension.AsRouteMethodInfo)
- {
- shardingQueryableAsRouteOptions = node.Arguments
- .OfType()
- .Where(o => o.Value is ShardingQueryableAsRouteOptions)
- .Select(o => (ShardingQueryableAsRouteOptions)o.Value)
- .Last();
- return node.Arguments[0];
- }
- else if (genericMethodDefinition == EntityFrameworkShardingQueryableExtension.AsSequenceModeMethodInfo)
- {
- shardingQueryableAsSequenceOptions = node.Arguments
- .OfType()
- .Where(o => o.Value is ShardingQueryableAsSequenceOptions)
- .Select(o => (ShardingQueryableAsSequenceOptions)o.Value)
- .Last();
- return node.Arguments[0];
- }
- }
-
- return null;
- }
-
- private void DiscoverQueryEntities(MethodCallExpression node)
- {
- var genericArguments = node.Type.GetGenericArguments();
- for (var i = 0; i < genericArguments.Length; i++)
- {
- var genericArgument = genericArguments[i];
-
- if (typeof(IEnumerable).IsAssignableFrom(genericArgument))
- {
- var arguments = genericArgument.GetGenericArguments();
- foreach (var argument in arguments)
- {
- //if is db context model
- if (_trackerManager.IsDbContextModel(argument))
- {
- TryAddShardingEntities(argument, null);
- }
- }
- }
-
- if (!genericArgument.IsSimpleType())
- {
- //if is db context model
- if (_trackerManager.IsDbContextModel(genericArgument))
- {
- TryAddShardingEntities(genericArgument, null);
- }
- }
- }
- }
-
-
- }
-}
-#endif
diff --git a/src/ShardingCore/Utils/ShardingUtil.cs b/src/ShardingCore/Utils/ShardingUtil.cs
index 5948b1e6..90cafae8 100644
--- a/src/ShardingCore/Utils/ShardingUtil.cs
+++ b/src/ShardingCore/Utils/ShardingUtil.cs
@@ -10,7 +10,6 @@ using ShardingCore.Core;
using ShardingCore.Core.EntityMetadatas;
using ShardingCore.Core.Internal;
using ShardingCore.Core.Internal.Visitors;
-using ShardingCore.Core.Internal.Visitors.Querys;
using ShardingCore.Core.TrackerManagers;
using ShardingCore.Core.VirtualDatabase;
using ShardingCore.Core.VirtualRoutes;
diff --git a/src2_6/ShardingCore.2_6/ShardingCore.2_6.csproj b/src2_6/ShardingCore.2_6/ShardingCore.2_6.csproj
deleted file mode 100644
index 1d58896b..00000000
--- a/src2_6/ShardingCore.2_6/ShardingCore.2_6.csproj
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
- netcoreapp2;netcoreapp3;netstandard2.0;netstandard2.1;net5;net6
- 6.8.0.9
- true
- TRACE;DEBUG;SHARDINGCORE2_6
- latest
- https://github.com/dotnetcore/sharding-core
- logo.png
- ShardingCore
- ShardingCore
-
-
- true
- bin\Release\ShardingCore.2x.xml
- latest
-
-
- true
- bin\Release\ShardingCore.3x.xml
- latest
-
-
-
- true
- bin\Release\ShardingCore.5x.xml
- latest
-
-
-
- true
- bin\Release\ShardingCore.6x.xml
- latest
-
-
- latest
-
-
- true
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
- 1701;1702;1591;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- \
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/ShardingCore.Test2x/ShardingCore.Test2x.csproj b/test/ShardingCore.Test2x/ShardingCore.Test2x.csproj
index b39408d5..72624fe2 100644
--- a/test/ShardingCore.Test2x/ShardingCore.Test2x.csproj
+++ b/test/ShardingCore.Test2x/ShardingCore.Test2x.csproj
@@ -18,6 +18,7 @@
+
diff --git a/test/ShardingCore.Test3x/ShardingCore.Test3x.csproj b/test/ShardingCore.Test3x/ShardingCore.Test3x.csproj
index 9cf5a245..22477b32 100644
--- a/test/ShardingCore.Test3x/ShardingCore.Test3x.csproj
+++ b/test/ShardingCore.Test3x/ShardingCore.Test3x.csproj
@@ -19,5 +19,6 @@
+
diff --git a/test/ShardingCore.Test5x/ShardingCore.Test5x.csproj b/test/ShardingCore.Test5x/ShardingCore.Test5x.csproj
index 15c85756..65e13ab0 100644
--- a/test/ShardingCore.Test5x/ShardingCore.Test5x.csproj
+++ b/test/ShardingCore.Test5x/ShardingCore.Test5x.csproj
@@ -21,5 +21,6 @@
+
diff --git a/test/ShardingCore.Test6x/ShardingCore.Test6x.csproj b/test/ShardingCore.Test6x/ShardingCore.Test6x.csproj
index 79f56a99..6b9f51ea 100644
--- a/test/ShardingCore.Test6x/ShardingCore.Test6x.csproj
+++ b/test/ShardingCore.Test6x/ShardingCore.Test6x.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -20,6 +20,7 @@
+