File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
src/EFCore.SqlServer/Query/Internal
test/EFCore.SqlServer.FunctionalTests/Query Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ private readonly
32
32
33
33
private RelationalTypeMapping ? _nvarcharMaxTypeMapping ;
34
34
35
+ private static readonly bool UseOldBehavior32976 =
36
+ AppContext . TryGetSwitch ( "Microsoft.EntityFrameworkCore.Issue32976" , out var enabled32976 ) && enabled32976 ;
37
+
35
38
/// <summary>
36
39
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
37
40
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -70,7 +73,14 @@ public virtual Expression Process(Expression expression)
70
73
switch ( expression )
71
74
{
72
75
case ShapedQueryExpression shapedQueryExpression :
73
- return shapedQueryExpression . UpdateQueryExpression ( Visit ( shapedQueryExpression . QueryExpression ) ) ;
76
+ shapedQueryExpression = shapedQueryExpression . UpdateQueryExpression ( Visit ( shapedQueryExpression . QueryExpression ) ) ;
77
+
78
+ if ( ! UseOldBehavior32976 )
79
+ {
80
+ shapedQueryExpression = shapedQueryExpression . UpdateShaperExpression ( Visit ( shapedQueryExpression . ShaperExpression ) ) ;
81
+ }
82
+
83
+ return shapedQueryExpression ;
74
84
75
85
case SelectExpression selectExpression :
76
86
{
Original file line number Diff line number Diff line change @@ -871,6 +871,42 @@ public virtual async Task Same_collection_with_conflicting_type_mappings_not_sup
871
871
872
872
#endregion Type mapping inference
873
873
874
+ [ ConditionalFact ]
875
+ public virtual async Task Ordered_collection_with_split_query ( )
876
+ {
877
+ var contextFactory = await InitializeAsync < Context32976 > (
878
+ onModelCreating : mb => mb . Entity < Context32976 . Principal > ( ) ,
879
+ seed : context =>
880
+ {
881
+ context . Add ( new Context32976 . Principal { Ints = [ 2 , 3 , 4 ] } ) ;
882
+ context . SaveChanges ( ) ;
883
+ } ) ;
884
+
885
+ await using var context = contextFactory . CreateContext ( ) ;
886
+
887
+ _ = await context . Set < Context32976 . Principal > ( )
888
+ . Where ( p => p . Ints . Skip ( 1 ) . Contains ( 3 ) )
889
+ . Include ( p => p . Dependents )
890
+ . AsSplitQuery ( )
891
+ . SingleAsync ( ) ;
892
+ }
893
+
894
+ public class Context32976 ( DbContextOptions options ) : DbContext ( options )
895
+ {
896
+ public class Principal
897
+ {
898
+ public int Id { get ; set ; }
899
+ public List < int > Ints { get ; set ; }
900
+ public List < Dependent > Dependents { get ; set ; }
901
+ }
902
+
903
+ public class Dependent
904
+ {
905
+ public int Id { get ; set ; }
906
+ public Principal Principal { get ; set ; }
907
+ }
908
+ }
909
+
874
910
[ ConditionalFact ]
875
911
public virtual void Check_all_tests_overridden ( )
876
912
=> TestHelpers . AssertAllMethodsOverridden ( GetType ( ) ) ;
You can’t perform that action at this time.
0 commit comments