From 4901074848b07416b3e6c85af8f485e6718b658f Mon Sep 17 00:00:00 2001 From: xuejiaming <326308290@qq.com> Date: Fri, 4 Mar 2022 15:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83x.4.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nuget-publish.bat | 8 ++-- ...tityFrameworkShardingQueryableExtension.cs | 37 ------------------- .../Abstractions/ICompileParameter.cs | 4 +- .../ShardingExecutors/CompileParameter.cs | 10 ++--- .../ShardingExecutors/QueryCompilerContext.cs | 2 +- .../ShardingExtParameter.cs | 6 +-- 6 files changed, 15 insertions(+), 52 deletions(-) diff --git a/nuget-publish.bat b/nuget-publish.bat index 0316c944..8d54bc87 100644 --- a/nuget-publish.bat +++ b/nuget-publish.bat @@ -1,9 +1,9 @@ :start ::定义版本 -set EFCORE2=2.4.1.10 -set EFCORE3=3.4.1.10 -set EFCORE5=5.4.1.10 -set EFCORE6=6.4.1.10 +set EFCORE2=2.4.2.01 +set EFCORE3=3.4.2.01 +set EFCORE5=5.4.2.01 +set EFCORE6=6.4.2.01 ::删除所有bin与obj下的文件 @echo off diff --git a/src/ShardingCore/Extensions/ShardingQueryableExtensions/EntityFrameworkShardingQueryableExtension.cs b/src/ShardingCore/Extensions/ShardingQueryableExtensions/EntityFrameworkShardingQueryableExtension.cs index 7eebaa0a..87c96afe 100644 --- a/src/ShardingCore/Extensions/ShardingQueryableExtensions/EntityFrameworkShardingQueryableExtension.cs +++ b/src/ShardingCore/Extensions/ShardingQueryableExtensions/EntityFrameworkShardingQueryableExtension.cs @@ -69,43 +69,6 @@ source.Provider is EntityQueryProvider source.Expression)) : source; } - /// - /// 流式聚合 - /// - /// - /// - /// - public static IQueryable StreamMerge(this IQueryable source) - { - Check.NotNull(source, nameof(source)); - return - source.Provider is EntityQueryProvider - ? source.Provider.CreateQuery( - Expression.Call( - (Expression)null, - NotSupportMethodInfo.MakeGenericMethod(typeof(TEntity)), - source.Expression)) - : source; - } - /// - /// 是否使用流式聚合 - /// - /// - /// - /// - /// - internal static IQueryable Merge(this IQueryable source,bool isStreamMerge) - { - Check.NotNull(source, nameof(source)); - return - source.Provider is EntityQueryProvider - ? source.Provider.CreateQuery( - Expression.Call( - (Expression)null, - NotSupportMethodInfo.MakeGenericMethod(typeof(TEntity)), - source.Expression)) - : source; - } /// /// 需要Route启用HintRoute:开启提示路由的前提下手动指定表、手动指定数据源 diff --git a/src/ShardingCore/Sharding/ShardingExecutors/Abstractions/ICompileParameter.cs b/src/ShardingCore/Sharding/ShardingExecutors/Abstractions/ICompileParameter.cs index 2133c7a2..c321ea38 100644 --- a/src/ShardingCore/Sharding/ShardingExecutors/Abstractions/ICompileParameter.cs +++ b/src/ShardingCore/Sharding/ShardingExecutors/Abstractions/ICompileParameter.cs @@ -26,10 +26,10 @@ public interface ICompileParameter /// Expression GetNativeQueryExpression(); /// - /// 当前查询是否是支持的查询 + /// 是否使用union all 聚合 /// /// - bool IsNotSupport(); + bool UseUnionAllMerge(); /// /// 当前查询的连接数限制 /// diff --git a/src/ShardingCore/Sharding/ShardingExecutors/CompileParameter.cs b/src/ShardingCore/Sharding/ShardingExecutors/CompileParameter.cs index 968669d3..32c5f041 100644 --- a/src/ShardingCore/Sharding/ShardingExecutors/CompileParameter.cs +++ b/src/ShardingCore/Sharding/ShardingExecutors/CompileParameter.cs @@ -20,7 +20,7 @@ public class CompileParameter:ICompileParameter,IPrint { private readonly IShardingDbContext _shardingDbContext; private readonly Expression _nativeQueryExpression; - private readonly bool _isNotSupport; + private readonly bool _useUnionAllMerge; private readonly int? _maxQueryConnectionsLimit; private readonly ConnectionModeEnum? _connectionMode; private readonly bool? _readOnly; @@ -34,7 +34,7 @@ public CompileParameter(IShardingDbContext shardingDbContext,Expression sharding _nativeQueryExpression = shardingQueryableExtractParameter.Visit(shardingQueryExpression); var extractShardingParameter = shardingQueryableExtractParameter.ExtractShardingParameter(); _shardingRouteConfigure = extractShardingParameter.ShardingQueryableAsRouteOptions?.RouteConfigure; - _isNotSupport = extractShardingParameter.IsNotSupport; + _useUnionAllMerge = extractShardingParameter.UseUnionAllMerge; _maxQueryConnectionsLimit = extractShardingParameter.ShardingQueryableUseConnectionModeOptions?.MaxQueryConnectionsLimit; _connectionMode = extractShardingParameter.ShardingQueryableUseConnectionModeOptions?.ConnectionMode; if (shardingDbContext.IsUseReadWriteSeparation()) @@ -57,9 +57,9 @@ public Expression GetNativeQueryExpression() return _nativeQueryExpression; } - public bool IsNotSupport() + public bool UseUnionAllMerge() { - return _isNotSupport; + return _useUnionAllMerge; } public int? GetMaxQueryConnectionsLimit() @@ -94,7 +94,7 @@ public Action GetAsRoute() public string GetPrintInfo() { - return $"is not support :{_isNotSupport},max query connections limit:{_maxQueryConnectionsLimit},connection mode:{_connectionMode},readonly:{_readOnly},as route:{_shardingRouteConfigure!=null},is sequence:{_isSequence},same with sharding comparer:{_sameWithShardingComparer}"; + return $"is not support :{_useUnionAllMerge},max query connections limit:{_maxQueryConnectionsLimit},connection mode:{_connectionMode},readonly:{_readOnly},as route:{_shardingRouteConfigure!=null},is sequence:{_isSequence},same with sharding comparer:{_sameWithShardingComparer}"; } } } \ No newline at end of file diff --git a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs index 657c417c..6dad7af3 100644 --- a/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs +++ b/src/ShardingCore/Sharding/ShardingExecutors/QueryCompilerContext.cs @@ -38,7 +38,7 @@ private QueryCompilerContext(ICompileParameter compileParameter) var compileParseResult = ShardingUtil.GetQueryCompileParseResultByExpression(_queryExpression, _shardingDbContextType); _queryEntities = compileParseResult.QueryEntities; _isNoTracking = compileParseResult.IsNoTracking; - _useUnionAllMerge = compileParameter.IsNotSupport(); + _useUnionAllMerge = compileParameter.UseUnionAllMerge(); _maxQueryConnectionsLimit = compileParameter.GetMaxQueryConnectionsLimit(); _connectionMode = compileParameter.GetConnectionMode(); _entityMetadataManager = ShardingContainer.GetRequiredEntityMetadataManager(_shardingDbContextType); diff --git a/src/ShardingCore/Sharding/Visitors/ShardingExtractParameters/ShardingExtParameter.cs b/src/ShardingCore/Sharding/Visitors/ShardingExtractParameters/ShardingExtParameter.cs index ff89e58f..51963d43 100644 --- a/src/ShardingCore/Sharding/Visitors/ShardingExtractParameters/ShardingExtParameter.cs +++ b/src/ShardingCore/Sharding/Visitors/ShardingExtractParameters/ShardingExtParameter.cs @@ -11,19 +11,19 @@ namespace ShardingCore.Sharding.Visitors.ShardingExtractParameters { internal class ShardingExtParameter { - public bool IsNotSupport { get; } + public bool UseUnionAllMerge { get; } public ShardingQueryableAsRouteOptions ShardingQueryableAsRouteOptions { get; } public ShardingQueryableUseConnectionModeOptions ShardingQueryableUseConnectionModeOptions { get; } public ShardingQueryableReadWriteSeparationOptions ShardingQueryableReadWriteSeparationOptions { get; } public ShardingQueryableAsSequenceOptions ShardingQueryableAsSequenceOptions { get; } - public ShardingExtParameter(bool isNotSupport, + public ShardingExtParameter(bool useUnionAllMerge, ShardingQueryableAsRouteOptions shardingQueryableAsRouteOptions, ShardingQueryableUseConnectionModeOptions shardingQueryableUseConnectionModeOptions, ShardingQueryableReadWriteSeparationOptions shardingQueryableReadWriteSeparationOptions, ShardingQueryableAsSequenceOptions shardingQueryableAsSequenceOptions) { - IsNotSupport = isNotSupport; + UseUnionAllMerge = useUnionAllMerge; ShardingQueryableAsRouteOptions = shardingQueryableAsRouteOptions; ShardingQueryableUseConnectionModeOptions = shardingQueryableUseConnectionModeOptions; ShardingQueryableReadWriteSeparationOptions = shardingQueryableReadWriteSeparationOptions;