修复newexpression在表达式内解析值不生效的bug,发布x.6.0.28
This commit is contained in:
parent
34c38445e6
commit
7273daa519
|
@ -1,9 +1,9 @@
|
|||
:start
|
||||
::定义版本
|
||||
set EFCORE2=2.6.0.27
|
||||
set EFCORE3=3.6.0.27
|
||||
set EFCORE5=5.6.0.27
|
||||
set EFCORE6=6.6.0.27
|
||||
set EFCORE2=2.6.0.28
|
||||
set EFCORE3=3.6.0.28
|
||||
set EFCORE5=5.6.0.28
|
||||
set EFCORE6=6.6.0.28
|
||||
|
||||
::删除所有bin与obj下的文件
|
||||
@echo off
|
||||
|
|
|
@ -216,8 +216,11 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
private bool ExpressionCanGetValue(Expression expression)
|
||||
{
|
||||
{
|
||||
return expression is ConstantExpression
|
||||
|| expression is NewExpression
|
||||
|| expression is ListInitExpression
|
||||
|| expression is NewArrayExpression
|
||||
|| (expression is MemberExpression member && (member.Expression is ConstantExpression ||
|
||||
member.Expression is MemberExpression ||
|
||||
member.Expression is MemberExpression))
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
{
|
||||
case ConstantExpression e:
|
||||
return e.Value;
|
||||
case NewExpression e:
|
||||
return e.Constructor?.Invoke(e.Arguments.Select(a => ((ConstantExpression)a).Value).ToArray());
|
||||
|
||||
case MemberExpression e when e.Member is FieldInfo field:
|
||||
return field.GetValue(
|
||||
|
|
|
@ -96,6 +96,7 @@ namespace ShardingCore.CommonTest
|
|||
var obj1 = new {time=new DateTime(2022, 1, 2)};
|
||||
var queryables=new List<IQueryable<TestTimeEntity>>()
|
||||
{
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time== new DateTime(2022, 1, 2)),
|
||||
new List<TestTimeEntity>().AsQueryable().CheckBetween((DateTime?)queryTime,(DateTime?)queryTime3,o=>o.Time),
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time==times2[0]),
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time>=times2[0]&&o.Time<times2[1]),
|
||||
|
|
Loading…
Reference in New Issue