diff --git a/nuget-publish.bat b/nuget-publish.bat index 6a441d65..da369b61 100644 --- a/nuget-publish.bat +++ b/nuget-publish.bat @@ -1,9 +1,9 @@ :start ::定义版本 -set EFCORE2=2.5.0.1 -set EFCORE3=3.5.0.1 -set EFCORE5=5.5.0.1 -set EFCORE6=6.5.0.1 +set EFCORE2=2.5.0.2 +set EFCORE3=3.5.0.2 +set EFCORE5=5.5.0.2 +set EFCORE6=6.5.0.2 ::删除所有bin与obj下的文件 @echo off diff --git a/samples/Sample.SqlServer/Controllers/ValuesController.cs b/samples/Sample.SqlServer/Controllers/ValuesController.cs index a18cd070..65938bf8 100644 --- a/samples/Sample.SqlServer/Controllers/ValuesController.cs +++ b/samples/Sample.SqlServer/Controllers/ValuesController.cs @@ -385,6 +385,7 @@ namespace Sample.SqlServer.Controllers [HttpGet] public async Task Get6() { + var resultx111 = await _defaultTableDbContext.Set().FirstOrDefaultAsync(o => o.Id == "198"); var sysUserSalaries = await _defaultTableDbContext.Set().Where(o=>o.DateOfMonth==202101).ToListAsync(); return Ok(); } diff --git a/samples/Sample.SqlServer/Properties/launchSettings.json b/samples/Sample.SqlServer/Properties/launchSettings.json index 89f54cc5..52dd9e9f 100644 --- a/samples/Sample.SqlServer/Properties/launchSettings.json +++ b/samples/Sample.SqlServer/Properties/launchSettings.json @@ -12,7 +12,7 @@ "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": true, - "launchUrl": "values/get", + "launchUrl": "values/get0", "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/src/ShardingCore/Sharding/Visitors/QueryableRouteDiscoverVisitor.cs b/src/ShardingCore/Sharding/Visitors/QueryableRouteDiscoverVisitor.cs index 81d77d73..2bd4b7e5 100644 --- a/src/ShardingCore/Sharding/Visitors/QueryableRouteDiscoverVisitor.cs +++ b/src/ShardingCore/Sharding/Visitors/QueryableRouteDiscoverVisitor.cs @@ -146,7 +146,8 @@ namespace ShardingCore.Core.Internal.Visitors { return expression is ConstantExpression || (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) @@ -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); - if (binaryExpression.Right is UnaryExpression unaryExpression2) + if (binaryExpression.Right is UnaryExpression unaryExpression2 && binaryExpression.Left is not MemberExpression) right = Resolve(unaryExpression2); //组合 diff --git a/src/ShardingCore/Sharding/Visitors/ShardingExpressionVisitor.cs b/src/ShardingCore/Sharding/Visitors/ShardingExpressionVisitor.cs index 7e8cceb0..d6378f31 100644 --- a/src/ShardingCore/Sharding/Visitors/ShardingExpressionVisitor.cs +++ b/src/ShardingCore/Sharding/Visitors/ShardingExpressionVisitor.cs @@ -95,6 +95,10 @@ namespace ShardingCore.Core.Internal.Visitors ) .ToArray() ); + case UnaryExpression e when e.NodeType == ExpressionType.Convert: + { + return GetExpressionValue(e.Operand); + } default: //TODO: better messaging