处理部分编译和samples问题

This commit is contained in:
xuejiaming 2023-11-22 15:24:00 +08:00
parent 0addfdd6ab
commit 531367bc79
16 changed files with 47 additions and 46 deletions

View File

@ -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

View File

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.UseRowNumberForPaging" Version="0.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0-alpha.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
</ItemGroup>
<ItemGroup>

View File

@ -2,21 +2,21 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.6" />
<PackageReference Include="EntityFrameworkCore.UseRowNumberForPaging" Version="0.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="EFCore.BulkExtensions" Version="6.5.6" />
<PackageReference Include="EntityFrameworkCore.UseRowNumberForPaging" Version="0.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ShardingCore\ShardingCore.csproj" />
<ProjectReference Include="..\..\src\ShardingCore\ShardingCore7.csproj" />
</ItemGroup>
</Project>

View File

@ -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