File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
src/Libraries/SmartStore.Services/Localization Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ protected virtual LocalizedPropertyCollection GetLocalizedPropertyCollectionInte
218
218
where x . LocaleKeyGroup == localeKeyGroup
219
219
select x ;
220
220
221
+ var splitEntityIds = false ;
221
222
var requestedSet = entityIds ;
222
223
223
224
if ( entityIds != null && entityIds . Length > 0 )
@@ -243,7 +244,15 @@ protected virtual LocalizedPropertyCollection GetLocalizedPropertyCollectionInte
243
244
else
244
245
{
245
246
requestedSet = entityIds ;
246
- query = query . Where ( x => entityIds . Contains ( x . EntityId ) ) ;
247
+
248
+ if ( entityIds . Length > 5000 )
249
+ {
250
+ splitEntityIds = true ;
251
+ }
252
+ else
253
+ {
254
+ query = query . Where ( x => entityIds . Contains ( x . EntityId ) ) ;
255
+ }
247
256
}
248
257
}
249
258
@@ -252,7 +261,20 @@ protected virtual LocalizedPropertyCollection GetLocalizedPropertyCollectionInte
252
261
query = query . Where ( x => x . LanguageId == languageId ) ;
253
262
}
254
263
255
- return new LocalizedPropertyCollection ( localeKeyGroup , requestedSet , query . ToList ( ) ) ;
264
+ if ( splitEntityIds )
265
+ {
266
+ var items = new List < LocalizedProperty > ( ) ;
267
+ foreach ( var chunk in entityIds . Slice ( 5000 ) )
268
+ {
269
+ items . AddRange ( query . Where ( x => chunk . Contains ( x . EntityId ) ) . ToList ( ) ) ;
270
+ }
271
+
272
+ return new LocalizedPropertyCollection ( localeKeyGroup , requestedSet , items ) ;
273
+ }
274
+ else
275
+ {
276
+ return new LocalizedPropertyCollection ( localeKeyGroup , requestedSet , query . ToList ( ) ) ;
277
+ }
256
278
}
257
279
}
258
280
You can’t perform that action at this time.
0 commit comments