[#72]修复未分表dbcontext置顶循环,并且优化NoShardingFirstComparer和修复一个bug,并且发布x.3.1.54

This commit is contained in:
xuejiaming 2021-11-29 07:57:20 +08:00
parent cb7ae4c714
commit 647c1d4678
3 changed files with 23 additions and 7 deletions

View File

@ -1,9 +1,9 @@
:start
::定义版本
set EFCORE2=2.3.1.53
set EFCORE3=3.3.1.53
set EFCORE5=5.3.1.53
set EFCORE6=6.3.1.53
set EFCORE2=2.3.1.54
set EFCORE3=3.3.1.54
set EFCORE5=5.3.1.54
set EFCORE6=6.3.1.54
::删除所有bin与obj下的文件
@echo off

View File

@ -25,8 +25,8 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
if (_defaultTail.Equals(x))
return -1;
if (_defaultTail.Equals(y))
return -1;
return x.SafeCompareToWith(y,true);
return 1;
return Comparer<string>.Default.Compare(x, y);
}
}
}

View File

@ -10,6 +10,7 @@ using ShardingCore.Core.QueryRouteManagers.Abstractions;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
using ShardingCore.Core.VirtualDatabase.VirtualDataSources.PhysicDataSources;
using ShardingCore.Core.VirtualDatabase.VirtualTables;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails;
using ShardingCore.Exceptions;
using ShardingCore.Extensions;
using ShardingCore.Extensions.ShardingPageExtensions;
@ -17,6 +18,7 @@ using ShardingCore.Helpers;
using ShardingCore.Sharding;
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
using ShardingCore.Sharding.ShardingComparision.Abstractions;
using ShardingCore.Sharding.ShardingDbContextExecutors;
using ShardingCore.TableCreator;
using ShardingCore.Test.Domain.Entities;
using Xunit;
@ -149,7 +151,21 @@ namespace ShardingCore.Test
Assert.True(shardingTableDbContext);
var virtualTable = _virtualTableManager.GetVirtualTable<SysUserMod>();
Assert.NotNull(virtualTable);
var emptyTailIdentity = new SingleQueryRouteTail(string.Empty).GetRouteTailIdentity();
var aTailIdentity = new SingleQueryRouteTail("a").GetRouteTailIdentity();
var bTailIdentity = new SingleQueryRouteTail("b").GetRouteTailIdentity();
var dics=new SortedDictionary<string, string>(new NoShardingFirstComparer());
var dicTails=new List<string>() { emptyTailIdentity, aTailIdentity, bTailIdentity };
for (int i = 0; i < 10; i++)
{
dics.Clear();
var reOrderList=dicTails.OrderBy(o => Guid.NewGuid()).ToList();
foreach (var tail in reOrderList)
{
dics.Add(tail, null);
}
Assert.Equal(",a,b", string.Join(",", dics.Keys));
}
}
public class SequenceClass