[#251] 修复表达式值获取
This commit is contained in:
parent
b9e1537118
commit
dcced0a7b8
|
@ -194,6 +194,14 @@ namespace Sample.MySql.Controllers
|
|||
name = o.Key.Name,
|
||||
count = o.Count()
|
||||
}).ToListAsync();
|
||||
|
||||
var asyncEnumerator = _defaultTableDbContext.Set<SysTest>().AsAsyncEnumerable();
|
||||
await foreach (var sysTest in asyncEnumerator)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
Console.WriteLine("1");
|
||||
}
|
||||
|
||||
var x=await (from ut in _defaultTableDbContext.Set<SysTest>()
|
||||
from uu in _defaultTableDbContext.Set<SysUserMod>()
|
||||
where ut.Id == uu.Id
|
||||
|
|
|
@ -45,7 +45,7 @@ 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());
|
||||
return e.Constructor?.Invoke(e.Arguments.Select(GetExpressionValue).ToArray());
|
||||
|
||||
case MemberExpression e when e.Member is FieldInfo field:
|
||||
return field.GetValue(
|
||||
|
|
|
@ -95,8 +95,10 @@ namespace ShardingCore.CommonTest
|
|||
var times2 = new []{queryTime,queryTime2};
|
||||
var obj1 = new {time=new DateTime(2022, 1, 2)};
|
||||
var dateTime = (DateTime?)new DateTime(2022, 1, 2);
|
||||
var day = 2;
|
||||
var queryables=new List<IQueryable<TestTimeEntity>>()
|
||||
{
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time== new DateTime(2022, 1, day)),
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time== dateTime),
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>dateTime==o.Time ),
|
||||
new List<TestTimeEntity>().AsQueryable().Where(o=>o.Time== new DateTime(2022, 1, 2)),
|
||||
|
|
Loading…
Reference in New Issue