From 531367bc79264c5a543e3f30db0a707e2c043b37 Mon Sep 17 00:00:00 2001 From: xuejiaming <326308290@qq.com> Date: Wed, 22 Nov 2023 15:24:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=83=A8=E5=88=86=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=92=8Csamples=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nuget-publish.bat | 11 +++-- .../Sample.MySQLDataSourceOnly.csproj | 8 ++-- samples/Sample.MySql/Sample.MySql.csproj | 8 ++-- .../Sample.SqlServer/Sample.SqlServer.csproj | 18 +++---- .../ScriptMigrationGenerator.cs | 0 .../ShardingChangeTracker.cs | 0 .../ShardingMigrator.cs | 0 .../ShardingModelSource.cs | 0 .../ShardingOptionsExtension.cs | 0 .../ShardingStateManager.cs | 0 .../ShardingWrapOptionsExtension.cs | 0 .../Tx/ShardingRelationalTransaction.cs | 0 .../ShardingRelationalTransactionFactory.cs | 0 .../ShardingRelationalTransactionManager.cs | 0 .../UnionAllMergeOptionsExtension.cs | 0 .../DbContextExtensionShardingCore.cs | 48 +++++++++---------- 16 files changed, 47 insertions(+), 46 deletions(-) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ScriptMigrationGenerator.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingChangeTracker.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingMigrator.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingModelSource.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingOptionsExtension.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingStateManager.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/ShardingWrapOptionsExtension.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/Tx/ShardingRelationalTransaction.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/Tx/ShardingRelationalTransactionFactory.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/Tx/ShardingRelationalTransactionManager.cs (100%) rename src/ShardingCore/EFCores/{EFCore7x => EFCore7_8x}/UnionAllMergeOptionsExtension.cs (100%) diff --git a/nuget-publish.bat b/nuget-publish.bat index 5f41e836..2da1f2af 100644 --- a/nuget-publish.bat +++ b/nuget-publish.bat @@ -1,10 +1,11 @@ :start ::定义版本 -set EFCORE7=7.7.1.18 -set EFCORE6=7.6.1.18 -set EFCORE5=7.5.1.18 -set EFCORE3=7.3.1.18 -set EFCORE2=7.2.1.18 +set EFCORE8=7.8.1.19 +set EFCORE7=7.7.1.19 +set EFCORE6=7.6.1.19 +set EFCORE5=7.5.1.19 +set EFCORE3=7.3.1.19 +set EFCORE2=7.2.1.19 ::删除所有bin与obj下的文件 @echo off diff --git a/samples/Sample.MySQLDataSourceOnly/Sample.MySQLDataSourceOnly.csproj b/samples/Sample.MySQLDataSourceOnly/Sample.MySQLDataSourceOnly.csproj index 149adba2..fcef3994 100644 --- a/samples/Sample.MySQLDataSourceOnly/Sample.MySQLDataSourceOnly.csproj +++ b/samples/Sample.MySQLDataSourceOnly/Sample.MySQLDataSourceOnly.csproj @@ -1,15 +1,15 @@ - net7.0 + net8.0 enable enable - - - + + + diff --git a/samples/Sample.MySql/Sample.MySql.csproj b/samples/Sample.MySql/Sample.MySql.csproj index c8598282..463764a0 100644 --- a/samples/Sample.MySql/Sample.MySql.csproj +++ b/samples/Sample.MySql/Sample.MySql.csproj @@ -1,19 +1,19 @@  - net6.0 + net8.0 enable enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/samples/Sample.SqlServer/Sample.SqlServer.csproj b/samples/Sample.SqlServer/Sample.SqlServer.csproj index 81271b7f..8cdf1b55 100644 --- a/samples/Sample.SqlServer/Sample.SqlServer.csproj +++ b/samples/Sample.SqlServer/Sample.SqlServer.csproj @@ -2,21 +2,21 @@ net6.0 - 9.0 + 9.0 - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + diff --git a/src/ShardingCore/EFCores/EFCore7x/ScriptMigrationGenerator.cs b/src/ShardingCore/EFCores/EFCore7_8x/ScriptMigrationGenerator.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ScriptMigrationGenerator.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ScriptMigrationGenerator.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingChangeTracker.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingChangeTracker.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingChangeTracker.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingChangeTracker.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingMigrator.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingMigrator.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingMigrator.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingMigrator.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingModelSource.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingModelSource.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingModelSource.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingModelSource.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingOptionsExtension.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingOptionsExtension.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingOptionsExtension.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingStateManager.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingStateManager.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingStateManager.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingStateManager.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/ShardingWrapOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore7_8x/ShardingWrapOptionsExtension.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/ShardingWrapOptionsExtension.cs rename to src/ShardingCore/EFCores/EFCore7_8x/ShardingWrapOptionsExtension.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransaction.cs b/src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransaction.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransaction.cs rename to src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransaction.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransactionFactory.cs b/src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransactionFactory.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransactionFactory.cs rename to src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransactionFactory.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransactionManager.cs b/src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransactionManager.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/Tx/ShardingRelationalTransactionManager.cs rename to src/ShardingCore/EFCores/EFCore7_8x/Tx/ShardingRelationalTransactionManager.cs diff --git a/src/ShardingCore/EFCores/EFCore7x/UnionAllMergeOptionsExtension.cs b/src/ShardingCore/EFCores/EFCore7_8x/UnionAllMergeOptionsExtension.cs similarity index 100% rename from src/ShardingCore/EFCores/EFCore7x/UnionAllMergeOptionsExtension.cs rename to src/ShardingCore/EFCores/EFCore7_8x/UnionAllMergeOptionsExtension.cs diff --git a/src/ShardingCore/Extensions/DbContextExtensions/DbContextExtensionShardingCore.cs b/src/ShardingCore/Extensions/DbContextExtensions/DbContextExtensionShardingCore.cs index ce2351e6..c26086ed 100644 --- a/src/ShardingCore/Extensions/DbContextExtensions/DbContextExtensionShardingCore.cs +++ b/src/ShardingCore/Extensions/DbContextExtensions/DbContextExtensionShardingCore.cs @@ -55,11 +55,11 @@ namespace ShardingCore.Extensions _data.Clear(); } } - var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; + var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; #if EFCORE6 || EFCORE7 var valueTuples = - contextModelRelationalModel.Tables.Where(o =>o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.EntityType.ClrType))).Select(o => o.Key).ToList(); + contextModelRelationalModel.Tables.Where(o =>o.Value.EntityTypeMappings.Any(m => entityMetadataManager.IsShardingTable(m.EntityType.ClrType))).Select(o => o.Key).ToList(); #endif #if EFCORE8 var valueTuples = @@ -68,10 +68,10 @@ namespace ShardingCore.Extensions for (int i = 0; i < valueTuples.Count; i++) { contextModelRelationalModel.Tables.Remove(valueTuples[i]); - } + } #endif - - + + #if EFCORE5 var entityTypes = contextModel.GetEntityTypes(); foreach (var entityType in entityTypes) @@ -164,23 +164,23 @@ namespace ShardingCore.Extensions _data.Clear(); } } - var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; + var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; #if EFCORE6 || EFCORE7 var valueTuples = - contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType)) ).Select(o => o.Key).ToList(); -#endif -#if EFCORE8 - var valueTuples = + contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType)) ).Select(o => o.Key).ToList(); +#endif +#if EFCORE8 + var valueTuples = contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.TypeBase.ClrType))).Select(o => o.Key).ToList(); #endif for (int i = 0; i < valueTuples.Count; i++) { contextModelRelationalModel.Tables.Remove(valueTuples[i]); - } + } #endif - - - + + + #if EFCORE5 var entityTypes = contextModel.GetEntityTypes(); foreach (var entityType in entityTypes) @@ -274,24 +274,24 @@ namespace ShardingCore.Extensions _data.Clear(); } } - var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; + var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel; #if EFCORE6 || EFCORE7 var valueTuples = contextModelRelationalModel.Tables .Where(o => o.Value.EntityTypeMappings.All(m => m.EntityType.ClrType != shardingType)) - .Select(o => o.Key).ToList(); -#endif -#if EFCORE8 - var valueTuples = - contextModelRelationalModel.Tables - .Where(o => o.Value.EntityTypeMappings.All(m => m.TypeBase.ClrType != shardingType)) - .Select(o => o.Key).ToList(); + .Select(o => o.Key).ToList(); #endif - +#if EFCORE8 + var valueTuples = + contextModelRelationalModel.Tables + .Where(o => o.Value.EntityTypeMappings.All(m => m.TypeBase.ClrType != shardingType)) + .Select(o => o.Key).ToList(); +#endif + for (int i = 0; i < valueTuples.Count; i++) { contextModelRelationalModel.Tables.Remove(valueTuples[i]); - } + } #endif