x.5.0.6修复内嵌查询bug
This commit is contained in:
parent
154feb72b6
commit
980918efd3
|
@ -1,9 +1,9 @@
|
|||
:start
|
||||
::定义版本
|
||||
set EFCORE2=2.5.0.4
|
||||
set EFCORE3=3.5.0.4
|
||||
set EFCORE5=5.5.0.4
|
||||
set EFCORE6=6.5.0.4
|
||||
set EFCORE2=2.5.0.6
|
||||
set EFCORE3=3.5.0.6
|
||||
set EFCORE5=5.5.0.6
|
||||
set EFCORE6=6.5.0.6
|
||||
|
||||
::删除所有bin与obj下的文件
|
||||
@echo off
|
||||
|
|
|
@ -85,36 +85,36 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
|||
(MemberExpression memberExpression)
|
||||
{
|
||||
|
||||
if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
|
||||
{
|
||||
// Recurse down to see if we can simplify...
|
||||
var expression = Visit(memberExpression.Expression);
|
||||
//if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
|
||||
//{
|
||||
// Recurse down to see if we can simplify...
|
||||
var expression = Visit(memberExpression.Expression);
|
||||
|
||||
// If we've ended up with a constant, and it's a property or a field,
|
||||
// we can simplify ourselves to a constant
|
||||
if (expression is ConstantExpression)
|
||||
// If we've ended up with a constant, and it's a property or a field,
|
||||
// we can simplify ourselves to a constant
|
||||
if (expression is ConstantExpression)
|
||||
{
|
||||
object container = ((ConstantExpression)expression).Value;
|
||||
var member = memberExpression.Member;
|
||||
if (member is FieldInfo fieldInfo)
|
||||
{
|
||||
object container = ((ConstantExpression)expression).Value;
|
||||
var member = memberExpression.Member;
|
||||
if (member is FieldInfo fieldInfo)
|
||||
object value = fieldInfo.GetValue(container);
|
||||
if (value is IQueryable queryable)
|
||||
{
|
||||
object value = fieldInfo.GetValue(container);
|
||||
if (value is IQueryable queryable)
|
||||
{
|
||||
TryAddShardingEntities(queryable.ElementType, queryable);
|
||||
}
|
||||
//return Expression.Constant(value);
|
||||
TryAddShardingEntities(queryable.ElementType, queryable);
|
||||
}
|
||||
if (member is PropertyInfo propertyInfo)
|
||||
//return Expression.Constant(value);
|
||||
}
|
||||
if (member is PropertyInfo propertyInfo)
|
||||
{
|
||||
object value = propertyInfo.GetValue(container, null);
|
||||
if (value is IQueryable queryable)
|
||||
{
|
||||
object value = propertyInfo.GetValue(container, null);
|
||||
if (value is IQueryable queryable)
|
||||
{
|
||||
TryAddShardingEntities(queryable.ElementType, queryable);
|
||||
}
|
||||
TryAddShardingEntities(queryable.ElementType, queryable);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
return base.VisitMember(memberExpression);
|
||||
}
|
||||
protected override Expression VisitMethodCall(MethodCallExpression node)
|
||||
|
|
|
@ -31,8 +31,8 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
(MemberExpression memberExpression)
|
||||
{
|
||||
// Recurse down to see if we can simplify...
|
||||
if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
|
||||
{
|
||||
//if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
|
||||
//{
|
||||
var expression = Visit(memberExpression.Expression);
|
||||
|
||||
// If we've ended up with a constant, and it's a property or a field,
|
||||
|
@ -69,7 +69,7 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
return base.VisitMember(memberExpression);
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ namespace ShardingCore.Core.Internal.Visitors
|
|||
{
|
||||
var tempVariableGenericType = typeof(TempDbVariable<>).GetGenericType0(dbContext.GetType());
|
||||
var tempVariable = Activator.CreateInstance(tempVariableGenericType, _dbContext);
|
||||
MemberExpression queryableMemberReplaceExpression =
|
||||
MemberExpression dbContextMemberReplaceExpression =
|
||||
Expression.Property(ConstantExpression.Constant(tempVariable), nameof(TempDbVariable<object>.DbContext));
|
||||
return queryableMemberReplaceExpression;
|
||||
return dbContextMemberReplaceExpression;
|
||||
}
|
||||
|
||||
internal sealed class TempVariable<T1>
|
||||
|
|
Loading…
Reference in New Issue