diff --git a/samples/Sample.MySql/Sample.MySql.csproj b/samples/Sample.MySql/Sample.MySql.csproj index fb86cb18..08b63cb5 100644 --- a/samples/Sample.MySql/Sample.MySql.csproj +++ b/samples/Sample.MySql/Sample.MySql.csproj @@ -7,15 +7,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/src/ShardingCore/Sharding/Visitors/DbContextReplaceQueryableVisitor.cs b/src/ShardingCore/Sharding/Visitors/DbContextReplaceQueryableVisitor.cs index 2294cf2f..6095b64b 100644 --- a/src/ShardingCore/Sharding/Visitors/DbContextReplaceQueryableVisitor.cs +++ b/src/ShardingCore/Sharding/Visitors/DbContextReplaceQueryableVisitor.cs @@ -102,10 +102,10 @@ namespace ShardingCore.Core.Internal.Visitors if (RootIsVisit&&node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType) { #if EFCORE2 || EFCORE3 - var notRoot = node.Arguments.All(o => !(o is ConstantExpression constantExpression&&constantExpression.Value is IQueryable)); + var notRoot = node.Arguments.IsEmpty(); #endif #if !EFCORE2 && !EFCORE3 - var notRoot = node.Arguments.All(o => !(o is QueryRootExpression)); + var notRoot = node.Arguments.IsEmpty(); #endif if (notRoot) { @@ -131,12 +131,6 @@ namespace ShardingCore.Core.Internal.Visitors return whereCallExpression; } - public Expression> WhereTrueExpression() - { - return t => true; - } - - internal sealed class TempVariable { public IQueryable Queryable { get; } @@ -151,20 +145,6 @@ namespace ShardingCore.Core.Internal.Visitors return Queryable; } } - internal sealed class TempMethodVariable - { - public IQueryable Queryable { get; } - - public TempMethodVariable(Func> func) - { - Queryable = func(); - } - - public IQueryable GetQueryable() - { - return Queryable; - } - } internal sealed class TempDbVariable {