diff --git a/src/ShardingCore.MySql/DIExtension.cs b/src/ShardingCore.MySql/DIExtension.cs index d4b50b47..20c41d17 100644 --- a/src/ShardingCore.MySql/DIExtension.cs +++ b/src/ShardingCore.MySql/DIExtension.cs @@ -38,14 +38,7 @@ namespace ShardingCore.MySql services.AddSingleton(options); services.AddShardingCore(); - services.AddScoped(); - services.AddScoped(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(typeof(IVirtualTable<>), typeof(OneDbVirtualTable<>)); - services.AddSingleton(); - services.AddSingleton(); + services.AddScoped(); services.AddSingleton(); if (options.HasSharding) { diff --git a/src/ShardingCore.MySql/SqlServerDbContextOptionsProvider.cs b/src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs similarity index 89% rename from src/ShardingCore.MySql/SqlServerDbContextOptionsProvider.cs rename to src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs index acefa686..168a90ee 100644 --- a/src/ShardingCore.MySql/SqlServerDbContextOptionsProvider.cs +++ b/src/ShardingCore.MySql/MySqlDbContextOptionsProvider.cs @@ -20,12 +20,12 @@ namespace ShardingCore.MySql * @Date: Thursday, 24 December 2020 10:33:51 * @Email: 326308290@qq.com */ - public class SqlServerDbContextOptionsProvider:IDbContextOptionsProvider + public class MySqlDbContextOptionsProvider:IDbContextOptionsProvider { private DbContextOptions _dbContextOptions; private MySqlConnection _connection; - public SqlServerDbContextOptionsProvider(MySqlOptions mySqlOptions,ILoggerFactory loggerFactory) + public MySqlDbContextOptionsProvider(MySqlOptions mySqlOptions,ILoggerFactory loggerFactory) { _connection=new MySqlConnection(mySqlOptions.ConnectionString); _dbContextOptions = new DbContextOptionsBuilder() diff --git a/src/ShardingCore.SqlServer/DIExtension.cs b/src/ShardingCore.SqlServer/DIExtension.cs index bc8e6573..f4cdc6ba 100644 --- a/src/ShardingCore.SqlServer/DIExtension.cs +++ b/src/ShardingCore.SqlServer/DIExtension.cs @@ -34,15 +34,9 @@ namespace ShardingCore.SqlServer var options = new SqlServerOptions(); configure(options); services.AddSingleton(options); + services.AddShardingCore(); - services.AddScoped(); services.AddScoped(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(typeof(IVirtualTable<>), typeof(OneDbVirtualTable<>)); - services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); if (options.HasSharding) { diff --git a/src/ShardingCore/Core/IShardingQueryable.cs b/src/ShardingCore/Core/IShardingQueryable.cs index 649e6800..4da156dc 100644 --- a/src/ShardingCore/Core/IShardingQueryable.cs +++ b/src/ShardingCore/Core/IShardingQueryable.cs @@ -111,6 +111,17 @@ namespace ShardingCore.Core /// /// Task FloatSumAsync(); + + /// + /// 平均数 + /// + /// + Task AverageAsync(); + /// + /// 平均数 + /// + /// + Task LongAverageAsync(); /// /// 平均数 /// diff --git a/src/ShardingCore/Core/Internal/RoutingRuleEngines/IRoutingRuleEngineFactory.cs b/src/ShardingCore/Core/Internal/RoutingRuleEngines/IRoutingRuleEngineFactory.cs index 2ba770e5..3f775c3e 100644 --- a/src/ShardingCore/Core/Internal/RoutingRuleEngines/IRoutingRuleEngineFactory.cs +++ b/src/ShardingCore/Core/Internal/RoutingRuleEngines/IRoutingRuleEngineFactory.cs @@ -15,5 +15,6 @@ namespace ShardingCore.Core.Internal.RoutingRuleEngines IRouteRuleEngine CreateEngine(); RouteRuleContext CreateContext(IQueryable queryable); IEnumerable Route(IQueryable queryable); + IEnumerable Route(IQueryable queryable,RouteRuleContext ruleContext); } } \ No newline at end of file diff --git a/src/ShardingCore/Core/Internal/RoutingRuleEngines/RoutingRuleEngineFactory.cs b/src/ShardingCore/Core/Internal/RoutingRuleEngines/RoutingRuleEngineFactory.cs index ae0d6003..f47da73a 100644 --- a/src/ShardingCore/Core/Internal/RoutingRuleEngines/RoutingRuleEngineFactory.cs +++ b/src/ShardingCore/Core/Internal/RoutingRuleEngines/RoutingRuleEngineFactory.cs @@ -35,8 +35,14 @@ namespace ShardingCore.Core.Internal.RoutingRuleEngines public IEnumerable Route(IQueryable queryable) { var engine = CreateEngine(); - var routeRuleContext = CreateContext(queryable); - return engine.Route(routeRuleContext); + var ruleContext = CreateContext(queryable); + return engine.Route(ruleContext); + } + + public IEnumerable Route(IQueryable queryable, RouteRuleContext ruleContext) + { + var engine = CreateEngine(); + return engine.Route(ruleContext); } } } \ No newline at end of file diff --git a/src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/GenericStreamMergeProxyEngine.cs b/src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/Proxies/GenericStreamMergeProxyEngine.cs similarity index 81% rename from src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/GenericStreamMergeProxyEngine.cs rename to src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/Proxies/GenericStreamMergeProxyEngine.cs index 4a744484..78ac2370 100644 --- a/src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/GenericStreamMergeProxyEngine.cs +++ b/src/ShardingCore/Core/Internal/StreamMerge/GenericMerges/Proxies/GenericStreamMergeProxyEngine.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using ShardingCore.Core.Internal.StreamMerge.Abstractions; -using ShardingCore.Core.Internal.StreamMerge.Enumerators; -namespace ShardingCore.Core.Internal.StreamMerge.GenericMerges +namespace ShardingCore.Core.Internal.StreamMerge.GenericMerges.Proxies { /* * @Author: xjm @@ -14,13 +12,11 @@ namespace ShardingCore.Core.Internal.StreamMerge.GenericMerges */ internal class GenericStreamMergeProxyEngine : IDisposable { - private readonly StreamMergeContext _mergeContext; private IStreamMergeEngine _streamMergeEngine; private GenericStreamMergeProxyEngine(StreamMergeContext mergeContext) { - _mergeContext = mergeContext; _streamMergeEngine = GenericStreamMergeEngine.Create(mergeContext); } diff --git a/src/ShardingCore/Core/Internal/StreamMerge/IStreamMergeContextFactory.cs b/src/ShardingCore/Core/Internal/StreamMerge/IStreamMergeContextFactory.cs index cf984fa6..60a45646 100644 --- a/src/ShardingCore/Core/Internal/StreamMerge/IStreamMergeContextFactory.cs +++ b/src/ShardingCore/Core/Internal/StreamMerge/IStreamMergeContextFactory.cs @@ -15,5 +15,6 @@ namespace ShardingCore.Core.Internal.StreamMerge { StreamMergeContext Create(IQueryable queryable, IEnumerable routeResults); StreamMergeContext Create(IQueryable queryable); + StreamMergeContext Create(IQueryable queryable, RouteRuleContext ruleContext); } } \ No newline at end of file diff --git a/src/ShardingCore/Core/Internal/StreamMerge/StreamMergeContextFactory.cs b/src/ShardingCore/Core/Internal/StreamMerge/StreamMergeContextFactory.cs index 9517aa39..f20e1150 100644 --- a/src/ShardingCore/Core/Internal/StreamMerge/StreamMergeContextFactory.cs +++ b/src/ShardingCore/Core/Internal/StreamMerge/StreamMergeContextFactory.cs @@ -33,5 +33,9 @@ namespace ShardingCore.Core.Internal.StreamMerge { return new StreamMergeContext(queryable, _routingRuleEngineFactory.Route(queryable), _shardingParallelDbContextFactory, _shardingScopeFactory); } + public StreamMergeContext Create(IQueryable queryable,RouteRuleContext ruleContext) + { + return new StreamMergeContext(queryable, _routingRuleEngineFactory.Route(queryable,ruleContext), _shardingParallelDbContextFactory, _shardingScopeFactory); + } } } \ No newline at end of file diff --git a/src/ShardingCore/Core/ShardingQueryable.cs b/src/ShardingCore/Core/ShardingQueryable.cs index 6d6d6097..e24fa0d1 100644 --- a/src/ShardingCore/Core/ShardingQueryable.cs +++ b/src/ShardingCore/Core/ShardingQueryable.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using ShardingCore.Core.Internal.RoutingRuleEngines; using ShardingCore.Core.Internal.StreamMerge; using ShardingCore.Core.Internal.StreamMerge.GenericMerges; +using ShardingCore.Core.Internal.StreamMerge.GenericMerges.Proxies; using ShardingCore.Core.VirtualTables; using ShardingCore.Extensions; #if EFCORE2 @@ -30,18 +31,16 @@ namespace ShardingCore.Core public class ShardingQueryable : IShardingQueryable { private IQueryable _source; - private bool _autoParseRoute = true; private readonly IStreamMergeContextFactory _streamMergeContextFactory; - private Dictionary _routes = new Dictionary(); - private readonly Dictionary> _endRoutes = new Dictionary>(); - private readonly IRoutingRuleEngineFactory _routingRuleEngineFactory; + private readonly RouteRuleContext _routeRuleContext; private ShardingQueryable(IQueryable source) { _source = source; _streamMergeContextFactory = ShardingContainer.Services.GetService(); - _routingRuleEngineFactory=ShardingContainer.Services.GetService(); + var routingRuleEngineFactory=ShardingContainer.Services.GetService(); + _routeRuleContext = routingRuleEngineFactory.CreateContext(source); } public static ShardingQueryable Create(IQueryable source) @@ -52,48 +51,25 @@ namespace ShardingCore.Core public IShardingQueryable EnableAutoRouteParse() { - _autoParseRoute = true; + _routeRuleContext.EnableAutoRouteParse(); return this; } public IShardingQueryable DisableAutoRouteParse() { - _autoParseRoute = false; + _routeRuleContext.DisableAutoRouteParse(); return this; } public IShardingQueryable AddManualRoute(Expression> predicate) where TShardingEntity : class, IShardingEntity { - var shardingEntityType = typeof(TShardingEntity); - if (!_routes.ContainsKey(shardingEntityType)) - { - ((Expression>) _routes[shardingEntityType]).And(predicate); - } - else - { - _routes.Add(typeof(TShardingEntity), predicate); - } - + _routeRuleContext.AddRoute(predicate); return this; } public IShardingQueryable AddManualRoute(IVirtualTable virtualTable, string tail) { - if (_endRoutes.ContainsKey(virtualTable)) - { - var tails = _endRoutes[virtualTable]; - if (!tails.Contains(tail)) - { - tails.Add(tail); - } - } - else - { - _endRoutes.Add(virtualTable, new List() - { - tail - }); - } + _routeRuleContext.AddRoute(virtualTable,tail); return this; } @@ -101,7 +77,7 @@ namespace ShardingCore.Core private StreamMergeContext GetContext() { - return _streamMergeContextFactory.Create(_source); + return _streamMergeContextFactory.Create(_source,_routeRuleContext); } private async Task> GetGenericMergeEngine(Func> efQuery) { @@ -210,6 +186,20 @@ namespace ShardingCore.Core return results.Sum()/results.Count(); } + public async Task AverageAsync() + { + if (typeof(T) != typeof(int)) + throw new InvalidOperationException($"{typeof(T)} cast to int failed"); + var results = await GetGenericMergeEngine(async queryable => await EntityFrameworkQueryableExtensions.AverageAsync((IQueryable) queryable)); + return results.Sum()/results.Count(); + } + public async Task LongAverageAsync() + { + if (typeof(T) != typeof(long)) + throw new InvalidOperationException($"{typeof(T)} cast to long failed"); + var results = await GetGenericMergeEngine(async queryable => await EntityFrameworkQueryableExtensions.AverageAsync((IQueryable) queryable)); + return results.Sum()/results.Count(); + } public async Task DoubleAverageAsync() { if (typeof(T) != typeof(double)) diff --git a/src/ShardingCore/DIExtension.cs b/src/ShardingCore/DIExtension.cs index bc722301..4b841eb8 100644 --- a/src/ShardingCore/DIExtension.cs +++ b/src/ShardingCore/DIExtension.cs @@ -2,6 +2,11 @@ using System; using Microsoft.Extensions.DependencyInjection; using ShardingCore.Core.Internal.RoutingRuleEngines; using ShardingCore.Core.Internal.StreamMerge; +using ShardingCore.Core.ShardingAccessors; +using ShardingCore.Core.VirtualTables; +using ShardingCore.DbContexts; +using ShardingCore.DbContexts.VirtualDbContexts; +using ShardingCore.TableCreator; namespace ShardingCore { @@ -19,6 +24,13 @@ namespace ShardingCore services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(typeof(IVirtualTable<>), typeof(OneDbVirtualTable<>)); + services.AddSingleton(); + services.AddSingleton(); return services; } } diff --git a/src/ShardingCore/Extensions/ShardingExtension.cs b/src/ShardingCore/Extensions/ShardingExtension.cs index 70db92ad..fedb6421 100644 --- a/src/ShardingCore/Extensions/ShardingExtension.cs +++ b/src/ShardingCore/Extensions/ShardingExtension.cs @@ -271,6 +271,100 @@ namespace ShardingCore.Extensions { return await ShardingSumAsync(source.Select(keySelector)); } + + + public static async Task ShardingAverageAsync(this IQueryable source) + { + return await ShardingQueryable.Create(source).AverageAsync(); + } + public static double ShardingAverage(this IQueryable source) + { + return ShardingQueryable.Create(source).Average(); + } + public static double ShardingAverage(this IQueryable source,Expression> keySelector) + { + return ShardingAverage(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source,Expression> keySelector) + { + return await ShardingAverageAsync(source.Select(keySelector)); + } + + + public static async Task ShardingAverageAsync(this IQueryable source) + { + return await ShardingQueryable.Create(source).AverageAsync(); + } + public static double ShardingAverage(this IQueryable source) + { + return ShardingQueryable.Create(source).Average(); + } + public static double ShardingAverage(this IQueryable source,Expression> keySelector) + { + return ShardingAverage(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source,Expression> keySelector) + { + return await ShardingAverageAsync(source.Select(keySelector)); + } + + + public static async Task ShardingAverageAsync(this IQueryable source) + { + return await ShardingQueryable.Create(source).AverageAsync(); + } + public static double ShardingAverage(this IQueryable source) + { + return ShardingQueryable.Create(source).Average(); + } + public static double ShardingAverage(this IQueryable source,Expression> keySelector) + { + return ShardingAverage(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source,Expression> keySelector) + { + return await ShardingAverageAsync(source.Select(keySelector)); + } + + + public static async Task ShardingAverageAsync(this IQueryable source) + { + return await ShardingQueryable.Create(source).DecimalAverageAsync(); + } + public static decimal ShardingAverage(this IQueryable source) + { + return ShardingQueryable.Create(source).DecimalAverage(); + } + public static decimal ShardingAverage(this IQueryable source,Expression> keySelector) + { + return ShardingAverage(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source,Expression> keySelector) + { + return await ShardingAverageAsync(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source) + { + return await ShardingQueryable.Create(source).FloatAverageAsync(); + } + public static float ShardingAverage(this IQueryable source) + { + return ShardingQueryable.Create(source).FloatAverage(); + } + public static float ShardingAverage(this IQueryable source,Expression> keySelector) + { + return ShardingAverage(source.Select(keySelector)); + } + + public static async Task ShardingAverageAsync(this IQueryable source,Expression> keySelector) + { + return await ShardingAverageAsync(source.Select(keySelector)); + } } } \ No newline at end of file diff --git a/src/ShardingCore/Extensions/ShardingSyncExtension.cs b/src/ShardingCore/Extensions/ShardingSyncExtension.cs index 3db87b3a..b6067c51 100644 --- a/src/ShardingCore/Extensions/ShardingSyncExtension.cs +++ b/src/ShardingCore/Extensions/ShardingSyncExtension.cs @@ -71,5 +71,26 @@ namespace ShardingCore.Extensions { return AsyncHelper.RunSync(() => queryable.MinAsync()); } + + public static double Average(this IShardingQueryable queryable) + { + return AsyncHelper.RunSync(() => queryable.AverageAsync()); + } + public static double LongAverage(this IShardingQueryable queryable) + { + return AsyncHelper.RunSync(() => queryable.LongAverageAsync()); + } + public static double DoubleAverage(this IShardingQueryable queryable) + { + return AsyncHelper.RunSync(() => queryable.DoubleAverageAsync()); + } + public static decimal DecimalAverage(this IShardingQueryable queryable) + { + return AsyncHelper.RunSync(() => queryable.DecimalAverageAsync()); + } + public static float FloatAverage(this IShardingQueryable queryable) + { + return AsyncHelper.RunSync(() => queryable.FloatAverageAsync()); + } } } \ No newline at end of file diff --git a/src2x/ShardingCore.2x/ShardingCore.2x.csproj b/src2x/ShardingCore.2x/ShardingCore.2x.csproj index 74f0df2a..cc4b2488 100644 --- a/src2x/ShardingCore.2x/ShardingCore.2x.csproj +++ b/src2x/ShardingCore.2x/ShardingCore.2x.csproj @@ -20,6 +20,9 @@ + + Core\Internal\StreamMerge\StreamMergeExtension.cs + diff --git a/test/ShardingCore.Test50.MySql/ShardingTest.cs b/test/ShardingCore.Test50.MySql/ShardingTest.cs index 6e49bc13..744008ec 100644 --- a/test/ShardingCore.Test50.MySql/ShardingTest.cs +++ b/test/ShardingCore.Test50.MySql/ShardingTest.cs @@ -173,10 +173,18 @@ namespace ShardingCore.Test50.MySql [Fact] public async Task FirstOrDefault5() { - var sysUserMod=await _virtualDbContext.Set().Where(o=>o.Name=="name_1001").ShardingFirstOrDefaultAsync(); + var sysUserMod=await _virtualDbContext.Set().Where(o=>o.Name=="name_101").ShardingFirstOrDefaultAsync(); Assert.Null(sysUserMod); var sysUserRange=await _virtualDbContext.Set().Where(o=>o.Name=="name_range_1001").ShardingFirstOrDefaultAsync(); Assert.Null(sysUserRange); } + [Fact] + public async Task Count_Test() + { + var a=await _virtualDbContext.Set().Where(o=>o.Name=="name_100").ShardingCountAsync(); + Assert.Equal(1,a); + var b=await _virtualDbContext.Set().Where(o=>o.Name!="name_100").ShardingCountAsync(); + Assert.Equal(99,b); + } } } \ No newline at end of file diff --git a/test/ShardingCore.Test50/ShardingTest.cs b/test/ShardingCore.Test50/ShardingTest.cs index ca4d7a57..89707b33 100644 --- a/test/ShardingCore.Test50/ShardingTest.cs +++ b/test/ShardingCore.Test50/ShardingTest.cs @@ -35,10 +35,22 @@ namespace ShardingCore.Test50 { var modascs=await _virtualDbContext.Set().OrderBy(o=>o.Age).ToShardingListAsync(); Assert.Equal(100,modascs.Count); - Assert.Equal(100,modascs.Last().Age); + var i = 1; + foreach (var age in modascs) + { + Assert.Equal(i,age.Age); + i++; + + } var moddescs=await _virtualDbContext.Set().OrderByDescending(o=>o.Age).ToShardingListAsync(); Assert.Equal(100,moddescs.Count); - Assert.Equal(1,moddescs.Last().Age); + var j = 100; + foreach (var age in moddescs) + { + Assert.Equal(j,age.Age); + j--; + + } } [Fact] public async Task ToList_Id_In_Test() @@ -51,6 +63,8 @@ namespace ShardingCore.Test50 Assert.Contains(sysUserMods, o =>o.Id==id); Assert.Contains(sysUserRanges, o =>o.Id==id); } + Assert.DoesNotContain(sysUserMods,o=>o.Age>4); + Assert.DoesNotContain(sysUserRanges,o=>o.Age>4); } [Fact] public async Task ToList_Id_Eq_Test() @@ -73,6 +87,21 @@ namespace ShardingCore.Test50 Assert.DoesNotContain(ranges,o=>o.Id=="3"); } [Fact] + public async Task ToList_Id_Not_Eq_Skip_Test() + { + var mods=await _virtualDbContext.Set().Where(o=>o.Id!="3").OrderBy(o=>o.Age).Skip(2).ToShardingListAsync(); + Assert.Equal(97,mods.Count); + Assert.DoesNotContain(mods,o=>o.Id=="3"); + Assert.Equal(4,mods[0].Age); + Assert.Equal(5,mods[1].Age); + + var modsDesc=await _virtualDbContext.Set().Where(o=>o.Id!="3").OrderByDescending(o=>o.Age).Skip(13).ToShardingListAsync(); + Assert.Equal(86,modsDesc.Count); + Assert.DoesNotContain(mods,o=>o.Id=="3"); + Assert.Equal(87,modsDesc[0].Age); + Assert.Equal(86,modsDesc[1].Age); + } + [Fact] public async Task ToList_Name_Eq_Test() { var mods=await _virtualDbContext.Set().Where(o=>o.Name=="name_3").ToShardingListAsync(); @@ -101,8 +130,15 @@ namespace ShardingCore.Test50 [Fact] public async Task FirstOrDefault_Order_By_Id_Test() { + var sysUserModAge=await _virtualDbContext.Set().OrderBy(o=>o.Age).ShardingFirstOrDefaultAsync(); + Assert.True(sysUserModAge!=null&&sysUserModAge.Id=="1"); + var sysUserModAgeDesc=await _virtualDbContext.Set().OrderByDescending(o=>o.Age).ShardingFirstOrDefaultAsync(); + Assert.True(sysUserModAgeDesc!=null&&sysUserModAgeDesc.Id=="100"); var sysUserMod=await _virtualDbContext.Set().OrderBy(o=>o.Id).ShardingFirstOrDefaultAsync(); Assert.True(sysUserMod!=null&&sysUserMod.Id=="1"); + + var sysUserModDesc=await _virtualDbContext.Set().OrderByDescending(o=>o.Id).ShardingFirstOrDefaultAsync(); + Assert.True(sysUserModDesc!=null&&sysUserModDesc.Id=="99"); var sysUserRange=await _virtualDbContext.Set().OrderBy(o=>o.Id).ShardingFirstOrDefaultAsync(); Assert.True(sysUserRange!=null&&sysUserRange.Id=="1"); } @@ -137,10 +173,18 @@ namespace ShardingCore.Test50 [Fact] public async Task FirstOrDefault5() { - var sysUserMod=await _virtualDbContext.Set().Where(o=>o.Name=="name_1001").ShardingFirstOrDefaultAsync(); + var sysUserMod=await _virtualDbContext.Set().Where(o=>o.Name=="name_101").ShardingFirstOrDefaultAsync(); Assert.Null(sysUserMod); var sysUserRange=await _virtualDbContext.Set().Where(o=>o.Name=="name_range_1001").ShardingFirstOrDefaultAsync(); Assert.Null(sysUserRange); } + [Fact] + public async Task Count_Test() + { + var a=await _virtualDbContext.Set().Where(o=>o.Name=="name_100").ShardingCountAsync(); + Assert.Equal(1,a); + var b=await _virtualDbContext.Set().Where(o=>o.Name!="name_100").ShardingCountAsync(); + Assert.Equal(99,b); + } } } \ No newline at end of file