完成将shardingcore从net依赖转变为efcore依赖

This commit is contained in:
xuejiaming 2022-11-23 14:30:07 +08:00
parent 28073bff13
commit 4276d23cf3
74 changed files with 99 additions and 417 deletions

View File

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

View File

@ -18,6 +18,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src5\ShardingCore5\ShardingCore5.csproj" />
</ItemGroup>
</Project>

View File

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

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -11,6 +11,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -16,6 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -9,6 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src3\ShardingCore3\ShardingCore3.csproj" />
</ItemGroup>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
#if EFCORE2&&SHARDINGCORE2_6
#if EFCORE2
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if EFCORE2&&SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;

View File

@ -1,5 +1,4 @@
#if EFCORE2&&SHARDINGCORE2_6
#if EFCORE2
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

View File

@ -1,4 +1,4 @@
#if EFCORE2&&SHARDINGCORE2_6
#if EFCORE2
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;

View File

@ -1,5 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if EFCORE2&&SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Data;

View File

@ -1,4 +1,4 @@
#if EFCORE2 && SHARDINGCORE2_6
#if EFCORE2
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
#if EFCORE3
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;

View File

@ -1,5 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
#if EFCORE3
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Data;

View File

@ -1,4 +1,4 @@
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
#if EFCORE3
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
#if EFCORE5
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
#if EFCORE5
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
#if EFCORE5
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;

View File

@ -1,5 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
#if EFCORE5
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,5 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Data;

View File

@ -1,4 +1,4 @@
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
#if EFCORE5
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if EFCORE6&&SHARDINGCORE2_6
#if EFCORE6
using Microsoft.EntityFrameworkCore.Migrations;
using ShardingCore.Core.RuntimeContexts;

View File

@ -1,4 +1,4 @@
#if EFCORE6&&SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Internal;

View File

@ -1,5 +1,4 @@
#if EFCORE6&&SHARDINGCORE2_6
#if EFCORE6
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

View File

@ -1,5 +1,4 @@

#if EFCORE6&&SHARDINGCORE2_6
#if EFCORE6
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
#if EFCORE6&&SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using System.Data.Common;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;

View File

@ -1,4 +1,4 @@
#if EFCORE6 && SHARDINGCORE2_6
#if EFCORE6
using System;
using System.Collections.Generic;
using System.Text;

View File

@ -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,12 +65,16 @@ 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);
}
@ -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);
}
@ -230,5 +233,3 @@ namespace ShardingCore.Sharding.Parsers.Visitors
}
}
#endif

View File

@ -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
{
/// <summary>
///
/// </summary>
/// 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<Type, IQueryable> 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<ConstantExpression>()
.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<ConstantExpression>()
.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<ConstantExpression>()
.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

View File

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

View File

@ -1,98 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2;netcoreapp3;netstandard2.0;netstandard2.1;net5;net6</TargetFrameworks>
<Version>6.8.0.9</Version>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<DefineConstants>TRACE;DEBUG;SHARDINGCORE2_6</DefineConstants>
<LangVersion>latest</LangVersion>
<RepositoryUrl>https://github.com/dotnetcore/sharding-core</RepositoryUrl>
<PackageIcon>logo.png</PackageIcon>
<RootNamespace>ShardingCore</RootNamespace>
<AssemblyName>ShardingCore</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and '$(TargetFramework)' == 'netcoreapp2'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.2x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and ('$(TargetFramework)' == 'netcoreapp3' or '$(TargetFramework)' == 'netstandard2.0')">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.3x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and ('$(TargetFramework)' == 'net5' or '$(TargetFramework)' == 'netstandard2.1')">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.5x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU' and '$(TargetFramework)' == 'net6'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DocumentationFile>bin\Release\ShardingCore.6x.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp2|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp3|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp3|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net5|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net5|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\ShardingCore\**\*.cs" />
<Compile Remove="..\..\src\ShardingCore\obj\**" />
<Compile Remove="..\..\src\ShardingCore\bin\**" />
<Compile Remove="Core\VirtualRoutes\RouteConditions\**" />
<Compile Remove="Sharding\Abstractions\MergeParseContexts\**" />
<EmbeddedResource Remove="Core\VirtualRoutes\RouteConditions\**" />
<EmbeddedResource Remove="Sharding\Abstractions\MergeParseContexts\**" />
<None Remove="Core\VirtualRoutes\RouteConditions\**" />
<None Remove="Sharding\Abstractions\MergeParseContexts\**" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\Logo\logo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5' or '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.*" />
</ItemGroup>
</Project>

View File

@ -18,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src2\ShardingCore2\ShardingCore2.csproj" />
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
</ItemGroup>

View File

@ -19,5 +19,6 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src3\ShardingCore3\ShardingCore3.csproj" />
</ItemGroup>
</Project>

View File

@ -21,5 +21,6 @@
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src5\ShardingCore5\ShardingCore5.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src2_6\ShardingCore.2_6\ShardingCore.2_6.csproj" />
<ProjectReference Include="..\..\src6\ShardingCore6\ShardingCore6.csproj" />
</ItemGroup>
</Project>