x.3.2.7修复单路由多表的bug

This commit is contained in:
xuejiaming 2021-12-30 16:57:35 +08:00
parent c3b55c5af9
commit 4fdb273ead
4 changed files with 33 additions and 6 deletions

View File

@ -1,9 +1,9 @@
:start
::定义版本
set EFCORE2=2.3.2.06
set EFCORE3=3.3.2.06
set EFCORE5=5.3.2.06
set EFCORE6=6.3.2.06
set EFCORE2=2.3.2.07
set EFCORE3=3.3.2.07
set EFCORE5=5.3.2.07
set EFCORE6=6.3.2.07
::删除所有bin与obj下的文件
@echo off

View File

@ -11,6 +11,9 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using ShardingCore;
using ShardingCore.Core.VirtualDatabase.VirtualTables;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine;
namespace Sample.SqlServer.Controllers
{
@ -35,6 +38,14 @@ namespace Sample.SqlServer.Controllers
[HttpGet]
public async Task<IActionResult> Get2x()
{
//var queryable = _defaultTableDbContext.Set<SysUserMod>().Where(o=>true);
//var tableRouteRuleEngineFactory = ShardingContainer.GetService<ITableRouteRuleEngineFactory<DefaultShardingDbContext>>();
//var tableRouteResults = tableRouteRuleEngineFactory.Route(queryable);
var virtualTableManager = ShardingContainer.GetService<IVirtualTableManager<DefaultShardingDbContext>>();
var virtualTable = virtualTableManager.GetVirtualTable<SysUserMod>();
var virtualTableRoute = virtualTable.GetVirtualRoute();
var allTails = virtualTableRoute.GetAllTails();
Console.WriteLine("------------------Get2x------------------------");
using (var dbContext =
DbContextHelper.CreateDbContextByString(

View File

@ -117,7 +117,7 @@ namespace ShardingCore.Sharding.ShardingExecutors
if (hasQueryCompilerExecutor.Value)
{
var routeTailFactory = ShardingContainer.GetService<IRouteTailFactory>();
var dbContext = GetShardingDbContext().GetDbContext(_dataSourceRouteResult.IntersectDataSources.First(), CurrentQueryReadConnection(), routeTailFactory.Create(_tableRouteResults.First()));
var dbContext = GetShardingDbContext().GetDbContext(_dataSourceRouteResult.IntersectDataSources.First(), !IsQueryTrack() || CurrentQueryReadConnection(), routeTailFactory.Create(_tableRouteResults.First()));
_queryCompilerExecutor = new QueryCompilerExecutor(dbContext, GetQueryExpression());
}
}

View File

@ -36,8 +36,24 @@ namespace ShardingCore.Test.Shardings
return true;
}
}
//public class HistoryMinCompare : IComparer<string>
//{
// private const string History = "History";
public class OrderCreateTimePaginationConfiguration : IPaginationConfiguration<Order>
// public int Compare(string? x, string? y)
// {
// if (!Object.Equals(x, y))
// {
// if (History.Equals(x))
// return -1;
// if (History.Equals(y))
// return 1;
// }
// return Comparer<string>.Default.Compare(x, y);
// }
//}
public class OrderCreateTimePaginationConfiguration : IPaginationConfiguration<Order>
{
public void Configure(PaginationBuilder<Order> builder)
{