Skip to content

Commit afec836

Browse files
committed
修复bug
1 parent a939058 commit afec836

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

samples/Sample.MySql/Sample.MySql.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8">
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
14+
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\..\src5x\ShardingCore.5x\ShardingCore.5x.csproj" />
18+
<ProjectReference Include="..\..\src\ShardingCore\ShardingCore.csproj" />
1919
</ItemGroup>
2020

2121

src/ShardingCore/Sharding/Visitors/DbContextReplaceQueryableVisitor.cs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
102102
if (RootIsVisit&&node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType)
103103
{
104104
#if EFCORE2 || EFCORE3
105-
var notRoot = node.Arguments.All(o => !(o is ConstantExpression constantExpression&&constantExpression.Value is IQueryable));
105+
var notRoot = node.Arguments.IsEmpty();
106106
#endif
107107
#if !EFCORE2 && !EFCORE3
108-
var notRoot = node.Arguments.All(o => !(o is QueryRootExpression));
108+
var notRoot = node.Arguments.IsEmpty();
109109
#endif
110110
if (notRoot)
111111
{
@@ -131,12 +131,6 @@ private MethodCallExpression ReplaceMethodCallExpression(MethodCallExpression me
131131
return whereCallExpression;
132132
}
133133

134-
public Expression<Func<T, bool>> WhereTrueExpression<T>()
135-
{
136-
return t => true;
137-
}
138-
139-
140134
internal sealed class TempVariable<T1>
141135
{
142136
public IQueryable<T1> Queryable { get; }
@@ -151,20 +145,6 @@ public IQueryable<T1> GetQueryable()
151145
return Queryable;
152146
}
153147
}
154-
internal sealed class TempMethodVariable<T1>
155-
{
156-
public IQueryable<T1> Queryable { get; }
157-
158-
public TempMethodVariable(Func<IQueryable<T1>> func)
159-
{
160-
Queryable = func();
161-
}
162-
163-
public IQueryable<T1> GetQueryable()
164-
{
165-
return Queryable;
166-
}
167-
}
168148

169149
internal sealed class TempDbVariable<T1>
170150
{

0 commit comments

Comments
 (0)