Skip to content

Commit

Permalink
x.5.0.6修复内嵌查询bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xuejmnet committed Jun 8, 2022
1 parent 154feb7 commit 980918e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions nuget-publish.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,36 @@ protected override Expression VisitMember
(MemberExpression memberExpression)
{

if (memberExpression.IsMemberQueryable()) //2x,3x 路由 单元测试 分表和不分表
//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)
{
// 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)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ protected override Expression VisitMember
(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,
Expand Down Expand Up @@ -69,7 +69,7 @@ protected override Expression VisitMember
}
}
}
}
//}

return base.VisitMember(memberExpression);
}
Expand All @@ -89,9 +89,9 @@ private MemberExpression ReplaceMemberExpression(DbContext dbContext)
{
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>
Expand Down

0 comments on commit 980918e

Please sign in to comment.