File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -114,5 +114,36 @@ public void CacheableRegionBeforeOtherClauses()
114
114
Assert . That ( Sfi . Statistics . QueryCachePutCount , Is . EqualTo ( 2 ) ) ;
115
115
Assert . That ( Sfi . Statistics . QueryCacheHitCount , Is . EqualTo ( 1 ) ) ;
116
116
}
117
+
118
+ [ Test ]
119
+ public void GroupByQueryIsCacheable ( )
120
+ {
121
+ Sfi . Statistics . Clear ( ) ;
122
+ Sfi . QueryCache . Clear ( ) ;
123
+
124
+ var c = db
125
+ . Customers
126
+ . GroupBy ( x => x . Address . Country )
127
+ . Select ( x => x . Key )
128
+ . Cacheable ( )
129
+ . ToList ( ) ;
130
+
131
+ c = db
132
+ . Customers
133
+ . GroupBy ( x => x . Address . Country )
134
+ . Select ( x => x . Key )
135
+ . ToList ( ) ;
136
+
137
+ c = db
138
+ . Customers
139
+ . GroupBy ( x => x . Address . Country )
140
+ . Select ( x => x . Key )
141
+ . Cacheable ( )
142
+ . ToList ( ) ;
143
+
144
+ Assert . That ( Sfi . Statistics . QueryExecutionCount , Is . EqualTo ( 2 ) ) ;
145
+ Assert . That ( Sfi . Statistics . QueryCachePutCount , Is . EqualTo ( 1 ) ) ;
146
+ Assert . That ( Sfi . Statistics . QueryCacheHitCount , Is . EqualTo ( 1 ) ) ;
147
+ }
117
148
}
118
149
}
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public static class AggregatingGroupByRewriter
38
38
typeof ( AnyResultOperator ) ,
39
39
typeof ( AllResultOperator ) ,
40
40
typeof ( TimeoutResultOperator ) ,
41
+ typeof ( CacheableResultOperator )
41
42
} ;
42
43
43
44
public static void ReWrite ( QueryModel queryModel )
You can’t perform that action at this time.
0 commit comments