升级到efcore各自版本
This commit is contained in:
parent
ce1faf8d54
commit
436c902000
|
@ -63,6 +63,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore.2_6", "src2_6\
|
|||
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}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src5", "src5", "{53D07876-A791-46AE-8381-08557593693D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src2", "src2", "{B11D7DF7-A907-407E-8BF1-35B430413557}"
|
||||
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}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardingCore2", "src2\ShardingCore2\ShardingCore2.csproj", "{F0393C32-2285-4F47-AC61-C1BA1CAC269D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -169,6 +185,22 @@ Global
|
|||
{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
|
||||
{8ED3A191-5A29-4599-B383-9FD225CC0BA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3F80E6C2-D0AB-409D-B200-FFB6620E956A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3F80E6C2-D0AB-409D-B200-FFB6620E956A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3F80E6C2-D0AB-409D-B200-FFB6620E956A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3F80E6C2-D0AB-409D-B200-FFB6620E956A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E5E48D52-CAD3-42F0-82CD-A2A6180F3C4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B59909AD-8885-40F3-9454-6C8433463BCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B59909AD-8885-40F3-9454-6C8433463BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B59909AD-8885-40F3-9454-6C8433463BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B59909AD-8885-40F3-9454-6C8433463BCC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -199,6 +231,10 @@ Global
|
|||
{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}
|
||||
{B59909AD-8885-40F3-9454-6C8433463BCC} = {51E1D067-3E81-4815-94F2-F8ABBE80881E}
|
||||
{F0393C32-2285-4F47-AC61-C1BA1CAC269D} = {B11D7DF7-A907-407E-8BF1-35B430413557}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8C07A667-E8B4-43C7-8053-721584BAD291}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Extensions;
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Linq.Expressions;
|
|||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Extensions;
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace ShardingCore.Core
|
|||
/// Email: 326308290@qq.com
|
||||
public interface IShardingModelCacheOption
|
||||
{
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
CacheItemPriority GetModelCachePriority();
|
||||
int GetModelCacheEntrySize();
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ShardingCore.Core.VirtualRoutes
|
|||
return ReferenceEquals(this, obj) || obj is TableRouteUnit other && Equals(other);
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ namespace ShardingCore.Core.VirtualRoutes
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
|
|||
return $"(has different tail:{HasDifferentTail},current table:[{string.Join(",", ReplaceTables.Select(o => $"{o.DataSourceName}.{o.Tail}.{o.EntityType}"))}])";
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0&&SHARDINGCORE2_6
|
||||
#if EFCORE2&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0&&SHARDINGCORE2_6
|
||||
#if EFCORE2&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if NETCOREAPP2_0&&SHARDINGCORE2_6
|
||||
#if EFCORE2&&SHARDINGCORE2_6
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0&&SHARDINGCORE2_6
|
||||
#if EFCORE2&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0&&SHARDINGCORE2_6
|
||||
#if EFCORE2&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NETCOREAPP2_0 && SHARDINGCORE2_6
|
||||
#if EFCORE2 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0 )&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if (NETCOREAPP3_0 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
@ -52,7 +52,7 @@ namespace ShardingCore.EFCores
|
|||
_shardingDbContextExecutor.NotifyShardingTransaction();
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public override async Task RollbackAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
await base.RollbackAsync(cancellationToken);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NETCOREAPP3_0 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
#if (EFCORE3 || NETSTANDARD2_0) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1 ) && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if (NET5_0 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1)&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if (NET5_0 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
#if (EFCORE5 || NETSTANDARD2_1) && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0&&SHARDINGCORE2_6
|
||||
#if EFCORE6&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0&&SHARDINGCORE2_6
|
||||
#if EFCORE6&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if NET6_0&&SHARDINGCORE2_6
|
||||
#if EFCORE6&&SHARDINGCORE2_6
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if NET6_0&&SHARDINGCORE2_6
|
||||
#if EFCORE6&&SHARDINGCORE2_6
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0&&SHARDINGCORE2_6
|
||||
#if EFCORE6&&SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if NET6_0 && SHARDINGCORE2_6
|
||||
#if EFCORE6 && SHARDINGCORE2_6
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ShardingCore.EFCores
|
|||
private readonly IShardingDbContext _shardingDbContext;
|
||||
private readonly IShardingCompilerExecutor _shardingCompilerExecutor;
|
||||
//
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public ShardingQueryCompiler(IShardingRuntimeContext shardingRuntimeContext,IQueryContextFactory queryContextFactory, ICompiledQueryCache compiledQueryCache, ICompiledQueryCacheKeyGenerator compiledQueryCacheKeyGenerator, IDatabase database, IDiagnosticsLogger<DbLoggerCategory.Query> logger, ICurrentDbContext currentContext, IEvaluatableExpressionFilter evaluatableExpressionFilter, IModel model)
|
||||
: base(queryContextFactory, compiledQueryCache, compiledQueryCacheKeyGenerator, database, logger, currentContext, evaluatableExpressionFilter, model)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace ShardingCore.EFCores
|
|||
_shardingCompilerExecutor = shardingRuntimeContext.GetShardingCompilerExecutor();
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
|
||||
public ShardingQueryCompiler(IShardingRuntimeContext shardingRuntimeContext,IQueryContextFactory queryContextFactory, ICompiledQueryCache compiledQueryCache, ICompiledQueryCacheKeyGenerator compiledQueryCacheKeyGenerator, IDatabase database, IDiagnosticsLogger<DbLoggerCategory.Query> logger, ICurrentDbContext currentContext, IQueryModelGenerator queryModelGenerator)
|
||||
|
@ -62,7 +62,7 @@ namespace ShardingCore.EFCores
|
|||
}
|
||||
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override TResult ExecuteAsync<TResult>(Expression query, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ namespace ShardingCore.EFCores
|
|||
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public override IAsyncEnumerable<TResult> ExecuteAsync<TResult>(Expression query)
|
||||
{
|
||||
return _shardingCompilerExecutor.ExecuteAsync<TResult>(_shardingDbContext, query);
|
||||
|
|
|
@ -33,21 +33,21 @@ namespace ShardingCore.Extensions
|
|||
/// <param name="dbContext"></param>
|
||||
public static void RemoveDbContextRelationModelThatIsShardingTable(this DbContext dbContext)
|
||||
{
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !NETSTANDARD2_1 && !EFCORE5 && !EFCORE6
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0 || NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE2 || NETSTANDARD2_0 || EFCORE3 || EFCORE5 || NETSTANDARD2_1
|
||||
|
||||
var contextModel = dbContext.Model as Model;
|
||||
#endif
|
||||
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
||||
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
||||
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
foreach (var entityType in entityTypes)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace ShardingCore.Extensions
|
|||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||
}
|
||||
#endif
|
||||
#if NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE5 || NETSTANDARD2_1
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
foreach (var entityType in entityTypes)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ namespace ShardingCore.Extensions
|
|||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
|
||||
#if EFCORE2 || NETSTANDARD2_0 || EFCORE3
|
||||
var entityTypes =
|
||||
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
|
||||
foreach (var entityType in entityTypes)
|
||||
|
@ -105,23 +105,23 @@ namespace ShardingCore.Extensions
|
|||
// /// <param name="dbContext"></param>
|
||||
// public static void RemoveDbContextAllRelationModel(this DbContext dbContext)
|
||||
// {
|
||||
//#if NET6_0
|
||||
//#if EFCORE6
|
||||
|
||||
// var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
//#endif
|
||||
//#if NETCOREAPP2_0 || NETCOREAPP3_0 || NET5_0
|
||||
//#if EFCORE2 || EFCORE3 || EFCORE5
|
||||
|
||||
// var contextModel = dbContext.Model as Model;
|
||||
//#endif
|
||||
//#if NET6_0
|
||||
//#if EFCORE6
|
||||
// var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||
// contextModelRelationalModel.Tables.Clear();
|
||||
//#endif
|
||||
//#if NET5_0
|
||||
//#if EFCORE5
|
||||
// var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
||||
// contextModelRelationalModel.Tables.Clear();
|
||||
//#endif
|
||||
//#if NETCOREAPP2_0 || NETCOREAPP3_0
|
||||
//#if EFCORE2 || EFCORE3
|
||||
// var entityTypes =
|
||||
// contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
|
||||
// entityTypes.Clear();
|
||||
|
@ -133,21 +133,21 @@ namespace ShardingCore.Extensions
|
|||
/// <param name="dbContext"></param>
|
||||
public static void RemoveDbContextAllRelationModelWithoutShardingDataSourceOnly(this DbContext dbContext)
|
||||
{
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !NETSTANDARD2_1 && !EFCORE5 && !EFCORE6
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE2 || EFCORE3 || NETSTANDARD2_0 || EFCORE5 || NETSTANDARD2_1
|
||||
|
||||
var contextModel = dbContext.Model as Model;
|
||||
#endif
|
||||
var shardingRuntimeContext = dbContext.GetShardingRuntimeContext();
|
||||
var entityMetadataManager = shardingRuntimeContext.GetEntityMetadataManager();
|
||||
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
foreach (var entityType in entityTypes)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ namespace ShardingCore.Extensions
|
|||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||
}
|
||||
#endif
|
||||
#if NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE5 || NETSTANDARD2_1
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
foreach (var entityType in entityTypes)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace ShardingCore.Extensions
|
|||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
|
||||
#if EFCORE2 || NETSTANDARD2_0 || EFCORE3
|
||||
|
||||
var entityTypes =
|
||||
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
|
||||
|
@ -205,27 +205,27 @@ namespace ShardingCore.Extensions
|
|||
/// <param name="dbContext"></param>
|
||||
public static void RemoveDbContextAllRelationModel(this DbContext dbContext)
|
||||
{
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !NETSTANDARD2_1 && !EFCORE5 && !EFCORE6
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model; ;
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE2 || EFCORE3 || NETSTANDARD2_0 || EFCORE5 || NETSTANDARD2_1
|
||||
|
||||
var contextModel = dbContext.Model as Model;
|
||||
#endif
|
||||
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
var contextModelRelationalModel = contextModel.GetRelationalModel() as RelationalModel;
|
||||
contextModelRelationalModel.Tables.Clear();
|
||||
#endif
|
||||
#if NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE5 || NETSTANDARD2_1
|
||||
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
||||
contextModelRelationalModel.Tables.Clear();
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETCOREAPP3_0 || NETSTANDARD2_0
|
||||
#if EFCORE2 || EFCORE3 || NETSTANDARD2_0
|
||||
var entityTypes =
|
||||
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
|
||||
entityTypes.Clear();
|
||||
|
@ -240,14 +240,14 @@ namespace ShardingCore.Extensions
|
|||
public static void RemoveDbContextRelationModelSaveOnlyThatIsNamedType(this DbContext dbContext,
|
||||
Type shardingType)
|
||||
{
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !NETSTANDARD2_1 && !EFCORE5 && !EFCORE6
|
||||
1
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0 ||NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE2 || NETSTANDARD2_0 || EFCORE3 ||EFCORE5 || NETSTANDARD2_1
|
||||
|
||||
var contextModel = dbContext.Model as Model;
|
||||
#endif
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
var contextModel = dbContext.GetService<IDesignTimeModel>().Model;
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
foreach (var entityType in entityTypes)
|
||||
|
@ -268,7 +268,7 @@ namespace ShardingCore.Extensions
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE5 || NETSTANDARD2_1
|
||||
var contextModelRelationalModel = contextModel.RelationalModel as RelationalModel;
|
||||
|
||||
var entityTypes = contextModel.GetEntityTypes();
|
||||
|
@ -287,7 +287,7 @@ namespace ShardingCore.Extensions
|
|||
contextModelRelationalModel.Tables.Remove(valueTuples[i]);
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP3_0
|
||||
#if EFCORE2 || NETSTANDARD2_0 || EFCORE3
|
||||
var entityTypes =
|
||||
contextModel.GetFieldValue("_entityTypes") as SortedDictionary<string, EntityType>;
|
||||
|
||||
|
@ -318,10 +318,10 @@ namespace ShardingCore.Extensions
|
|||
/// <param name="dbContext"></param>
|
||||
public static void RemoveModelCache(this DbContext dbContext)
|
||||
{
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NETSTANDARD2_1 && !NET5_0 && !NET6_0
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !NETSTANDARD2_1 && !EFCORE5 && !EFCORE6
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
#if NET6_0
|
||||
#if EFCORE6
|
||||
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
|
||||
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();
|
||||
object key1 = modelCacheKeyFactory.Create(dbContext,true);
|
||||
|
@ -329,13 +329,13 @@ namespace ShardingCore.Extensions
|
|||
object key2 = modelCacheKeyFactory.Create(dbContext,false);
|
||||
shardingModelSource.Remove(key2);
|
||||
#endif
|
||||
#if NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE5 || NETSTANDARD2_1
|
||||
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
|
||||
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();
|
||||
object key1 = modelCacheKeyFactory.Create(dbContext);
|
||||
shardingModelSource.Remove(key1);
|
||||
#endif
|
||||
#if NETCOREAPP3_0 || NETSTANDARD2_0
|
||||
#if EFCORE3 || NETSTANDARD2_0
|
||||
|
||||
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
|
||||
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();
|
||||
|
@ -343,7 +343,7 @@ namespace ShardingCore.Extensions
|
|||
shardingModelSource.Remove(key1);
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
var shardingModelSource = dbContext.GetService<IModelSource>() as IShardingModelSource;
|
||||
var modelCacheKeyFactory = shardingModelSource.GetModelCacheKeyFactory();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
|
|
@ -17,10 +17,10 @@ namespace ShardingCore.Extensions.InternalExtensions
|
|||
/// <returns></returns>
|
||||
public static string GetEntityTypeTableName(this IEntityType entityType)
|
||||
{
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var tableName = entityType.GetTableName();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var tableName = entityType.Relational().TableName;
|
||||
#endif
|
||||
return tableName;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Extensions
|
|||
|
||||
//public static void ForEach<T>(this IEnumerable<T> source)
|
||||
|
||||
#if !NET5_0 || NETSTANDARD2_1
|
||||
#if !EFCORE5 || NETSTANDARD2_1
|
||||
public static HashSet<TSource> ToHashSet<TSource>(
|
||||
this IEnumerable<TSource> source,
|
||||
IEqualityComparer<TSource> comparer = null)
|
||||
|
|
|
@ -64,10 +64,10 @@ namespace ShardingCore.Extensions
|
|||
{
|
||||
return null;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
return expression.Print();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
return expression.ToString();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ namespace ShardingCore.Extensions
|
|||
{
|
||||
public static async Task<List<TEntity>> ToStreamListAsync<TEntity>(this IAsyncEnumerable<TEntity> source, int? take=null,CancellationToken cancellationToken=default)
|
||||
{
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var list = await source.ToList<TEntity>(cancellationToken);
|
||||
#endif
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var list = new List<TEntity>(take??4);
|
||||
await foreach (var element in source.WithCancellation(cancellationToken))
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ namespace ShardingCore.Extensions
|
|||
public static async Task<FixedElementCollection<TEntity>> ToFixedElementStreamListAsync<TEntity>(this IAsyncEnumerable<TEntity> source,int capacity,int maxVirtualElementCount,CancellationToken cancellationToken=default)
|
||||
{
|
||||
var fixedElementCollection = new FixedElementCollection<TEntity>(capacity);
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var asyncEnumerator = source.GetEnumerator();
|
||||
while (await asyncEnumerator.MoveNext(cancellationToken))
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ namespace ShardingCore.Extensions
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
await foreach (var element in source.WithCancellation(cancellationToken))
|
||||
{
|
||||
fixedElementCollection.Add(element);
|
||||
|
|
|
@ -25,14 +25,14 @@ namespace ShardingCore.Helpers
|
|||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((MigrationReplaceItem)obj);
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(SourceName, TargetName);
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace ShardingCore.Sharding
|
|||
|
||||
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override ValueTask<EntityEntry<TEntity>> AddAsync<TEntity>(TEntity entity, CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ namespace ShardingCore.Sharding
|
|||
return CreateGenericDbContext(entity).AddAsync(entity, cancellationToken);
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public override Task<EntityEntry<TEntity>> AddAsync<TEntity>(TEntity entity, CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
if (IsExecutor)
|
||||
|
@ -364,10 +364,10 @@ namespace ShardingCore.Sharding
|
|||
using (var tran = await Database.BeginTransactionAsync(cancellationToken))
|
||||
{
|
||||
i = await ShardingDbContextExecutor.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken);
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
tran.Commit();
|
||||
#endif
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
await tran.CommitAsync(cancellationToken);
|
||||
#endif
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ namespace ShardingCore.Sharding
|
|||
base.Dispose();
|
||||
}
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public override async ValueTask DisposeAsync()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
TResult Execute<TResult>(IShardingDbContext shardingDbContext, Expression query);
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
/// <summary>
|
||||
/// execute query async
|
||||
/// </summary>
|
||||
|
@ -31,7 +31,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
/// <returns></returns>
|
||||
TResult ExecuteAsync<TResult>(IShardingDbContext shardingDbContext, Expression query, CancellationToken cancellationToken = new CancellationToken());
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
/// <summary>
|
||||
/// execute query async
|
||||
/// </summary>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
public interface IShardingDbContextExecutor : IShardingTransaction,IReadWriteSwitch,ICurrentDbContextDiscover,IDisposable
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
, IAsyncDisposable
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@ using ShardingCore.Sharding.Enumerators;
|
|||
using ShardingCore.Sharding.ShardingExecutors;
|
||||
using ShardingCore.Sharding.ShardingExecutors.Abstractions;
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
/// <param name="queryCompilerContext"></param>
|
||||
/// <returns></returns>
|
||||
TResult Execute<TResult>(IQueryCompilerContext queryCompilerContext);
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
/// <summary>
|
||||
/// execute query async
|
||||
/// </summary>
|
||||
|
@ -30,7 +30,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
#endif
|
||||
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
/// <summary>
|
||||
/// execute query async
|
||||
/// </summary>
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
void NotifyShardingTransaction();
|
||||
void Rollback();
|
||||
void Commit();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
Task RollbackAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||
Task CommitAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||
#if !NETCOREAPP3_0 && !NETSTANDARD2_0
|
||||
#if !EFCORE3 && !NETSTANDARD2_0
|
||||
void CreateSavepoint(string name);
|
||||
Task CreateSavepointAsync(string name, CancellationToken cancellationToken = new CancellationToken());
|
||||
void RollbackToSavepoint(string name);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ShardingCore.Sharding.Abstractions
|
|||
// void NotifyShardingTransaction();
|
||||
// void Rollback();
|
||||
// void Commit();
|
||||
//#if !NETCOREAPP2_0
|
||||
//#if !EFCORE2
|
||||
// Task RollbackAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||
// Task CommitAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||
//#endif
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Exceptions;
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync.NETCOREAPP2_0x
|
||||
namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync.EFCORE2x
|
||||
{
|
||||
/*
|
||||
* @Author: xjm
|
||||
|
@ -14,13 +14,13 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync.NETCOREAPP2_0x
|
|||
* @Ver: 1.0
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if NETCOREAPP2_0
|
||||
internal class NETCOREAPP2_0TryCurrentAsyncEnumerator<T>:IAsyncEnumerator<T>
|
||||
#if EFCORE2
|
||||
internal class EFCORE2TryCurrentAsyncEnumerator<T>:IAsyncEnumerator<T>
|
||||
{
|
||||
private readonly IAsyncEnumerator<T> _asyncEnumerator;
|
||||
private bool currentMoved=false;
|
||||
|
||||
public NETCOREAPP2_0TryCurrentAsyncEnumerator(IAsyncEnumerator<T> asyncEnumerator)
|
||||
public EFCORE2TryCurrentAsyncEnumerator(IAsyncEnumerator<T> asyncEnumerator)
|
||||
{
|
||||
_asyncEnumerator = asyncEnumerator;
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
private async Task<IEnumerator<T>> GetAllRowsAsync(IStreamMergeAsyncEnumerator<T> streamMergeAsyncEnumerator)
|
||||
{
|
||||
var list = new List<T>();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
while (await streamMergeAsyncEnumerator.MoveNextAsync())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
while (await streamMergeAsyncEnumerator.MoveNext(new CancellationToken()))
|
||||
#endif
|
||||
{
|
||||
|
@ -49,10 +49,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
private IEnumerator<T> GetAllRows(IStreamMergeAsyncEnumerator<T> streamMergeAsyncEnumerator)
|
||||
{
|
||||
var list = new List<T>();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
while ( streamMergeAsyncEnumerator.MoveNext())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
while (streamMergeAsyncEnumerator.MoveNext())
|
||||
#endif
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
return _inMemoryReallyCount;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
return _inMemoryEnumerator.Current;
|
||||
}
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public void Dispose()
|
||||
{
|
||||
_inMemoryEnumerator?.Dispose();
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
return _inMemoryReallyCount;
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
return _reverseEnumerator.MoveNext();
|
||||
}
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public async Task<bool> MoveNext(CancellationToken cancellationToken)
|
||||
{
|
||||
if (_first)
|
||||
|
|
|
@ -33,10 +33,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
private async Task<IEnumerator<T>> GetAllRowsAsync(IStreamMergeAsyncEnumerator<T> streamMergeAsyncEnumerator)
|
||||
{
|
||||
var list = new List<T>();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
while (await streamMergeAsyncEnumerator.MoveNextAsync())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
while (await streamMergeAsyncEnumerator.MoveNext(new CancellationToken()))
|
||||
#endif
|
||||
{
|
||||
|
@ -48,10 +48,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
private IEnumerator<T> GetAllRows(IStreamMergeAsyncEnumerator<T> streamMergeAsyncEnumerator)
|
||||
{
|
||||
var list = new List<T>();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
while ( streamMergeAsyncEnumerator.MoveNext())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
while (streamMergeAsyncEnumerator.MoveNext())
|
||||
#endif
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
return _inMemoryReallyCount;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
return _inMemoryEnumerator.Current;
|
||||
}
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public void Dispose()
|
||||
{
|
||||
_inMemoryEnumerator?.Dispose();
|
||||
|
|
|
@ -58,19 +58,19 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
return _mergeContext.SelectContext.SelectProperties.Where(o => !(o is SelectAggregateProperty))
|
||||
.Select(o => first.GetValueByExpression(o.PropertyName).value).ToList();
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public async ValueTask<bool> MoveNextAsync()
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public async Task<bool> MoveNext(CancellationToken cancellationToken = new CancellationToken())
|
||||
#endif
|
||||
{
|
||||
if (_queue.IsEmpty())
|
||||
return false;
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var hasNext = await SetCurrentValueAsync();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var hasNext = await SetCurrentValueAsync(cancellationToken);
|
||||
#endif
|
||||
if (hasNext)
|
||||
|
@ -91,10 +91,10 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
|
||||
return true;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
private async ValueTask<bool> SetCurrentValueAsync()
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
private async Task<bool> SetCurrentValueAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
#endif
|
||||
{
|
||||
|
@ -106,10 +106,10 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
currentValues.Add(current);
|
||||
var first = _queue.Poll();
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
if (await first.MoveNextAsync())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
if (await first.MoveNext(cancellationToken))
|
||||
#endif
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
return CurrentValue;
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
|
|
|
@ -45,10 +45,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
|
||||
_currentEnumerator = _queue.IsEmpty() ? _enumerators.FirstOrDefault() : _queue.Peek();
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public async ValueTask<bool> MoveNextAsync()
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public async Task<bool> MoveNext(CancellationToken cancellationToken = new CancellationToken())
|
||||
#endif
|
||||
{
|
||||
|
@ -61,11 +61,11 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
}
|
||||
|
||||
var first = _queue.Poll();
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
if (await first.MoveNextAsync())
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
if (await first.MoveNext(cancellationToken))
|
||||
#endif
|
||||
|
@ -128,7 +128,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
return _currentEnumerator.GetCurrent();
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
_moveIndex++;
|
||||
return HasElement();
|
||||
}
|
||||
#if !NETCOREAPP2_0 && !NETSTANDARD2_0 && !NETCOREAPP3_0 && !NET5_0 && !NETSTANDARD2_1
|
||||
#if !EFCORE2 && !NETSTANDARD2_0 && !EFCORE3 && !EFCORE5 && !NETSTANDARD2_1
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return ValueTask.CompletedTask;
|
||||
|
@ -46,7 +46,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
}
|
||||
|
||||
#endif
|
||||
#if NETCOREAPP3_0 || NETSTANDARD2_0 || NET5_0 || NETSTANDARD2_1
|
||||
#if EFCORE3 || NETSTANDARD2_0 || EFCORE5 || NETSTANDARD2_1
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return new ValueTask();
|
||||
|
@ -100,7 +100,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
return _constantElement;
|
||||
}
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -37,17 +37,17 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
_orderValues = HasElement() ? GetCurrentOrderValues() : new List<IComparable>(0);
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public async ValueTask<bool> MoveNextAsync()
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public async Task<bool> MoveNext(CancellationToken cancellationToken = new CancellationToken())
|
||||
#endif
|
||||
{
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var has = await _enumerator.MoveNextAsync();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var has = await _enumerator.MoveNext(cancellationToken);
|
||||
#endif
|
||||
SetOrderValues();
|
||||
|
@ -134,7 +134,7 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
{
|
||||
return _orderValues ?? new List<IComparable>(0);
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return _enumerator.DisposeAsync();
|
||||
|
|
|
@ -34,20 +34,20 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
else
|
||||
_enumerator = new MultiOrderStreamMergeAsyncEnumerator<T>(_mergeContext, sources);
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public async ValueTask<bool> MoveNextAsync()
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public async Task<bool> MoveNext(CancellationToken cancellationToken = new CancellationToken())
|
||||
#endif
|
||||
{
|
||||
//如果合并数据的时候不需要跳过也没有take多少那么就是直接next
|
||||
while (_skip.GetValueOrDefault() > this.realSkip)
|
||||
{
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var has = await _enumerator.MoveNextAsync();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var has = await _enumerator.MoveNext(cancellationToken);
|
||||
#endif
|
||||
|
||||
|
@ -56,10 +56,10 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
return false;
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var next = await _enumerator.MoveNextAsync();
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var next = await _enumerator.MoveNext(cancellationToken);
|
||||
#endif
|
||||
|
||||
|
@ -129,7 +129,7 @@ namespace ShardingCore.Sharding.Enumerators.StreamMergeAsync
|
|||
{
|
||||
_enumerator.Dispose();
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (_asyncEnumerator)
|
||||
|
@ -111,7 +111,7 @@ namespace ShardingCore.Sharding.Enumerators
|
|||
if (_syncEnumerator) return _syncSource.Current;
|
||||
return default;
|
||||
}
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public void Dispose()
|
||||
{
|
||||
_asyncSource?.Dispose();
|
||||
|
|
|
@ -20,14 +20,14 @@ namespace ShardingCore.Sharding.Enumerators.TrackerEnumerables
|
|||
_shardingDbContext = shardingDbContext;
|
||||
_asyncEnumerable = asyncEnumerable;
|
||||
}
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
return new AsyncTrackerEnumerator<T>(_shardingDbContext,_asyncEnumerable.GetAsyncEnumerator(cancellationToken));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public IAsyncEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return new AsyncTrackerEnumerator<T>(_shardingDbContext, _asyncEnumerable.GetEnumerator());
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace ShardingCore.Sharding.Enumerators.TrackerEnumerators
|
|||
* @Ver: 1.0
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
|
||||
internal class AsyncTrackerEnumerator<T> : IAsyncEnumerator<T>
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ namespace ShardingCore.Sharding.Enumerators.TrackerEnumerators
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
|
||||
public class AsyncTrackerEnumerator<T> : IAsyncEnumerator<T>
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ using ShardingCore.Sharding.Abstractions;
|
|||
using ShardingCore.Sharding.ShardingExecutors.Abstractions;
|
||||
using ShardingCore.Sharding.Visitors.Selects;
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Query.Sql;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ShardingCore.Sharding.MergeEngines.Enumerables
|
|||
{
|
||||
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return new ValueTask();
|
||||
|
@ -20,7 +20,7 @@ namespace ShardingCore.Sharding.MergeEngines.Enumerables
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
public Task<bool> MoveNext(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(false);
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ShardingCore.Sharding.MergeEngines.EnumeratorStreamMergeEngines
|
|||
}
|
||||
|
||||
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
@ -46,7 +46,7 @@ namespace ShardingCore.Sharding.MergeEngines.EnumeratorStreamMergeEngines
|
|||
}
|
||||
#endif
|
||||
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
IAsyncEnumerator<T> IAsyncEnumerable<T>.GetEnumerator()
|
||||
{
|
||||
if (!_mergeContext.TryPrepareExecuteContinueQuery(() => new EmptyQueryEnumerator<T>(),out var emptyQueryEnumerator))
|
||||
|
|
|
@ -5,13 +5,13 @@ using System.Threading.Tasks;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Sharding.Enumerators;
|
||||
using ShardingCore.Sharding.Enumerators.StreamMergeAsync;
|
||||
using ShardingCore.Sharding.Enumerators.StreamMergeAsync.NETCOREAPP2_0x;
|
||||
using ShardingCore.Sharding.Enumerators.StreamMergeAsync.EFCORE2x;
|
||||
using ShardingCore.Sharding.MergeEngines.Common;
|
||||
using ShardingCore.Sharding.MergeEngines.Executors.Abstractions;
|
||||
using ShardingCore.Sharding.MergeEngines.Executors.CircuitBreakers;
|
||||
using ShardingCore.Sharding.MergeEngines.ShardingMergeEngines.Abstractions;
|
||||
using ShardingCore.Sharding.ShardingExecutors;
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
using Microsoft.EntityFrameworkCore.Extensions.Internal;
|
||||
#endif
|
||||
|
||||
|
@ -65,14 +65,14 @@ namespace ShardingCore.Sharding.MergeEngines.Executors.Enumerables.Abstractions
|
|||
/// <returns></returns>
|
||||
public async Task<IAsyncEnumerator<TEntity>> GetAsyncEnumerator0(IQueryable<TEntity> newQueryable)
|
||||
{
|
||||
#if !NETCOREAPP2_0
|
||||
#if !EFCORE2
|
||||
var enumator = newQueryable.AsAsyncEnumerable().GetAsyncEnumerator();
|
||||
await enumator.MoveNextAsync();
|
||||
return enumator;
|
||||
#endif
|
||||
#if NETCOREAPP2_0
|
||||
#if EFCORE2
|
||||
var enumator =
|
||||
new NETCOREAPP2_0TryCurrentAsyncEnumerator<TEntity>(newQueryable.AsAsyncEnumerable().GetEnumerator());
|
||||
new EFCORE2TryCurrentAsyncEnumerator<TEntity>(newQueryable.AsAsyncEnumerable().GetEnumerator());
|
||||
await enumator.MoveNext();
|
||||
return enumator;
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if SHARDINGCORE7
|
||||
#if EFCORE7
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue