Merge branch 'dotnetcore:main' into main

This commit is contained in:
MysticBoy 2022-09-28 16:50:57 +08:00 committed by GitHub
commit 6c22a23b5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 94 deletions

View File

@ -29,74 +29,11 @@ namespace ShardingCore.Sharding.MergeEngines.Executors.Enumerables.Abstractions
{
}
// protected abstract IStreamMergeCombine GetStreamMergeCombine();
public override ICircuitBreaker CreateCircuitBreaker()
{
return new EnumerableCircuitBreaker(GetStreamMergeContext());
}
// protected override void MergeParallelExecuteResult(
// LinkedList<IStreamMergeAsyncEnumerator<TResult>> previewResults,
// IEnumerable<IStreamMergeAsyncEnumerator<TResult>> parallelResults, bool async)
// {
// var previewResultsCount = previewResults.Count;
// if (previewResultsCount > 1)
// {
// throw new ShardingCoreInvalidOperationException(
// $"{typeof(TResult)} {nameof(previewResults)} has more than one element in container");
// }
//
// var parallelCount = parallelResults.Count();
// if (parallelCount == 0)
// return;
// //聚合
// if (previewResults is LinkedList<IStreamMergeAsyncEnumerator<TResult>>
// previewInMemoryStreamEnumeratorResults &&
// parallelResults is IEnumerable<IStreamMergeAsyncEnumerator<TResult>> parallelStreamEnumeratorResults)
// {
// var mergeAsyncEnumerators = new LinkedList<IStreamMergeAsyncEnumerator<TResult>>();
// if (previewResultsCount == 1)
// {
// mergeAsyncEnumerators.AddLast(previewInMemoryStreamEnumeratorResults.First());
// }
//
// foreach (var parallelStreamEnumeratorResult in parallelStreamEnumeratorResults)
// {
// mergeAsyncEnumerators.AddLast(parallelStreamEnumeratorResult);
// }
//
// var combineStreamMergeAsyncEnumerator =
// CombineInMemoryStreamMergeAsyncEnumerator(mergeAsyncEnumerators.ToArray());
// // var streamMergeContext = GetStreamMergeContext();
// // IStreamMergeAsyncEnumerator<TResult> inMemoryStreamMergeAsyncEnumerator =streamMergeContext.HasGroupQuery()&&streamMergeContext.GroupQueryMemoryMerge()?
// // new InMemoryGroupByOrderStreamMergeAsyncEnumerator<TResult>(streamMergeContext,combineStreamMergeAsyncEnumerator,async):
// // new InMemoryStreamMergeAsyncEnumerator<TResult>(combineStreamMergeAsyncEnumerator, async);
// var inMemoryStreamMergeAsyncEnumerator= new InMemoryStreamMergeAsyncEnumerator<TResult>(combineStreamMergeAsyncEnumerator, async);
// previewInMemoryStreamEnumeratorResults.Clear();
// previewInMemoryStreamEnumeratorResults.AddLast(inMemoryStreamMergeAsyncEnumerator);
// //合并
// return;
// }
//
// throw new ShardingCoreInvalidOperationException(
// $"{typeof(TResult)} is not {typeof(IStreamMergeAsyncEnumerator<TResult>)}");
// }
// /// <summary>
// /// 合并成一个迭代器
// /// </summary>
// /// <param name="streamsAsyncEnumerators"></param>
// /// <returns></returns>
// public abstract IStreamMergeAsyncEnumerator<TResult> CombineStreamMergeAsyncEnumerator(
// IStreamMergeAsyncEnumerator<TResult>[] streamsAsyncEnumerators);
//
// public virtual IStreamMergeAsyncEnumerator<TResult> CombineInMemoryStreamMergeAsyncEnumerator(
// IStreamMergeAsyncEnumerator<TResult>[] streamsAsyncEnumerators)
// {
// return CombineStreamMergeAsyncEnumerator(streamsAsyncEnumerators);
// }
/// <summary>
/// 开启异步线程获取并发迭代器
/// </summary>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2;netcoreapp3;net5;net6</TargetFrameworks>
<Version>$(NET6_0)</Version>
<Version>$(EFCORE)</Version>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<DefineConstants>TRACE;DEBUG;</DefineConstants>
<LangVersion>latest</LangVersion>
@ -33,29 +33,29 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
<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 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 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 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 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 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 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 Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6|AnyCPU'">
<NoWarn>1701;1702;1591;</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Core\VirtualRoutes\RouteConditions\**" />

View File

@ -9,6 +9,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>

View File

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.8" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="Xunit.DependencyInjection" Version="8.5.0" />

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit" Version="2.4.1" />

View File

@ -24,11 +24,6 @@ namespace ShardingCore.Test2x
*/
public class Startup
{
public static readonly ILoggerFactory efLogger = LoggerFactory.Create(builder =>
{
builder.AddFilter((category, level) => category == DbLoggerCategory.Database.Command.Name && level == LogLevel.Information).AddConsole();
});
// 支持的形式:
// ConfigureServices(IServiceCollection services)
// ConfigureServices(IServiceCollection services, HostBuilderContext hostBuilderContext)
@ -60,11 +55,11 @@ namespace ShardingCore.Test2x
op.ThrowIfQueryRouteNotMatch = false;
op.UseShardingQuery((conStr, builder) =>
{
builder.UseSqlServer(conStr).UseLoggerFactory(efLogger);
builder.UseSqlServer(conStr);
});
op.UseShardingTransaction((connection, builder) =>
{
builder.UseSqlServer(connection).UseLoggerFactory(efLogger);
builder.UseSqlServer(connection);
});
op.AddDefaultDataSource("A",

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.29" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.18" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit" Version="2.4.1" />

View File

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.1" />