Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
515729175f
|
@ -1,10 +1,10 @@
|
||||||
:start
|
:start
|
||||||
::定义版本
|
::定义版本
|
||||||
set EFCORE7=7.7.0.9
|
set EFCORE7=7.7.0.12
|
||||||
set EFCORE6=7.6.0.9
|
set EFCORE6=7.6.0.12
|
||||||
set EFCORE5=7.5.0.9
|
set EFCORE5=7.5.0.12
|
||||||
set EFCORE3=7.3.0.9
|
set EFCORE3=7.3.0.12
|
||||||
set EFCORE2=7.2.0.9
|
set EFCORE2=7.2.0.12
|
||||||
|
|
||||||
::删除所有bin与obj下的文件
|
::删除所有bin与obj下的文件
|
||||||
@echo off
|
@echo off
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace ShardingCore.Extensions
|
||||||
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
||||||
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
||||||
|
|
||||||
#if EFCORE6
|
#if EFCORE6 || EFCORE7
|
||||||
var entityTypes = contextModel.GetEntityTypes();
|
var entityTypes = contextModel.GetEntityTypes();
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
{
|
{
|
||||||
|
@ -156,8 +156,17 @@ namespace ShardingCore.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
|
foreach (var keyValuePair in contextModelRelationalModel.Tables)
|
||||||
|
{
|
||||||
|
foreach (var valueEntityTypeMapping in keyValuePair.Value.EntityTypeMappings)
|
||||||
|
{
|
||||||
|
var x = !entityMetadataManager.IsOnlyShardingDataSource(valueEntityTypeMapping.EntityType.ClrType);
|
||||||
|
Console.WriteLine(valueEntityTypeMapping.EntityType.ClrType);
|
||||||
|
Console.WriteLine(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
var valueTuples =
|
var valueTuples =
|
||||||
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsShardingDataSource(m.EntityType.ClrType) ||entityMetadataManager.TryGet(m.EntityType.ClrType)==null)).Select(o => o.Key).ToList();
|
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType))).Select(o => o.Key).ToList();
|
||||||
for (int i = 0; i < valueTuples.Count; i++)
|
for (int i = 0; i < valueTuples.Count; i++)
|
||||||
{
|
{
|
||||||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||||
|
@ -174,7 +183,7 @@ namespace ShardingCore.Extensions
|
||||||
}
|
}
|
||||||
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
||||||
var valueTuples =
|
var valueTuples =
|
||||||
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsShardingDataSource(m.EntityType.ClrType)||entityMetadataManager.TryGet(m.EntityType.ClrType)==null)).Select(o => o.Key).ToList();
|
contextModelRelationalModel.Tables.Where(o => o.Value.EntityTypeMappings.Any(m => !entityMetadataManager.IsOnlyShardingDataSource(m.EntityType.ClrType))).Select(o => o.Key).ToList();
|
||||||
for (int i = 0; i < valueTuples.Count; i++)
|
for (int i = 0; i < valueTuples.Count; i++)
|
||||||
{
|
{
|
||||||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||||
|
@ -191,7 +200,7 @@ namespace ShardingCore.Extensions
|
||||||
_data.Clear();
|
_data.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var list = entityTypes.Where(o => !entityMetadataManager.IsShardingDataSource(o.Value.ClrType) || entityMetadataManager.TryGet(o.Value.ClrType) == null).Select(o => o.Key).ToList();
|
var list = entityTypes.Where(o => !entityMetadataManager.IsOnlyShardingDataSource(o.Value.ClrType)).Select(o => o.Key).ToList();
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
entityTypes.Remove(list[i]);
|
entityTypes.Remove(list[i]);
|
||||||
|
@ -216,7 +225,7 @@ namespace ShardingCore.Extensions
|
||||||
var contextModel = dbContext.Model as Model;
|
var contextModel = dbContext.Model as Model;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFCORE6
|
#if EFCORE6|| EFCORE7
|
||||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||||
contextModelRelationalModel.Tables.Clear();
|
contextModelRelationalModel.Tables.Clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>7.7.0.11</Version>
|
<Version>$(EFCORE7)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE7;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE7;</DefineConstants>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Version>7.2.0.11</Version>
|
<Version>$(EFCORE2)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE2;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE2;</DefineConstants>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Version>7.3.0.11</Version>
|
<Version>$(EFCORE3)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE3;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE3;</DefineConstants>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Version>7.5.0.11</Version>
|
<Version>$(EFCORE5)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE5;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE5;</DefineConstants>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>7.6.0.11</Version>
|
<Version>$(EFCORE6)</Version>
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
<DefineConstants>TRACE;DEBUG;EFCORE6;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EFCORE6;</DefineConstants>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
|
|
Loading…
Reference in New Issue