修复分片字段为null类型情况下的bug和对应分片值强转的bug导致分片无效,发布x.5.0.2

This commit is contained in:
xuejiaming 2022-06-02 13:07:33 +08:00
parent b17a841668
commit b0734801fa
5 changed files with 14 additions and 8 deletions

View File

@ -1,9 +1,9 @@
:start :start
::定义版本 ::定义版本
set EFCORE2=2.5.0.1 set EFCORE2=2.5.0.2
set EFCORE3=3.5.0.1 set EFCORE3=3.5.0.2
set EFCORE5=5.5.0.1 set EFCORE5=5.5.0.2
set EFCORE6=6.5.0.1 set EFCORE6=6.5.0.2
::删除所有bin与obj下的文件 ::删除所有bin与obj下的文件
@echo off @echo off

View File

@ -385,6 +385,7 @@ namespace Sample.SqlServer.Controllers
[HttpGet] [HttpGet]
public async Task<IActionResult> Get6() public async Task<IActionResult> Get6()
{ {
var resultx111 = await _defaultTableDbContext.Set<SysUserMod>().FirstOrDefaultAsync(o => o.Id == "198");
var sysUserSalaries = await _defaultTableDbContext.Set<SysUserSalary>().Where(o=>o.DateOfMonth==202101).ToListAsync(); var sysUserSalaries = await _defaultTableDbContext.Set<SysUserSalary>().Where(o=>o.DateOfMonth==202101).ToListAsync();
return Ok(); return Ok();
} }

View File

@ -12,7 +12,7 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": "true", "dotnetRunMessages": "true",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "values/get", "launchUrl": "values/get0",
"applicationUrl": "http://localhost:5000", "applicationUrl": "http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"

View File

@ -146,7 +146,8 @@ namespace ShardingCore.Core.Internal.Visitors
{ {
return expression is ConstantExpression return expression is ConstantExpression
|| (expression is MemberExpression member && (member.Expression is ConstantExpression || member.Expression is MemberExpression || member.Expression is MemberExpression)) || (expression is MemberExpression member && (member.Expression is ConstantExpression || member.Expression is MemberExpression || member.Expression is MemberExpression))
|| expression is MethodCallExpression; || expression is MethodCallExpression
|| (expression is UnaryExpression unaryExpression && unaryExpression.NodeType is ExpressionType.Convert ) ;
} }
private bool IsMethodCall(Expression expression) private bool IsMethodCall(Expression expression)
@ -470,9 +471,9 @@ namespace ShardingCore.Core.Internal.Visitors
} }
} }
if (binaryExpression.Left is UnaryExpression unaryExpression1) if (binaryExpression.Left is UnaryExpression unaryExpression1&& binaryExpression.Right is not MemberExpression)
left = Resolve(unaryExpression1); left = Resolve(unaryExpression1);
if (binaryExpression.Right is UnaryExpression unaryExpression2) if (binaryExpression.Right is UnaryExpression unaryExpression2 && binaryExpression.Left is not MemberExpression)
right = Resolve(unaryExpression2); right = Resolve(unaryExpression2);
//组合 //组合

View File

@ -95,6 +95,10 @@ namespace ShardingCore.Core.Internal.Visitors
) )
.ToArray() .ToArray()
); );
case UnaryExpression e when e.NodeType == ExpressionType.Convert:
{
return GetExpressionValue(e.Operand);
}
default: default:
//TODO: better messaging //TODO: better messaging