@@ -249,8 +249,9 @@ public IList[] GetMany(
249
249
continue ;
250
250
}
251
251
252
- var timestamp = GetResultsMetadata ( cacheable , out var aliases ) ; var key = keys [ i ] ;
253
- if ( key . ResultTransformer ? . AutoDiscoverTypes == true && HasResults ( cacheable ) )
252
+ var timestamp = GetResultsMetadata ( cacheable , out var aliases ) ;
253
+ var key = keys [ i ] ;
254
+ if ( key . ResultTransformer ? . AutoDiscoverTypes == true && ! IsEmpty ( cacheable ) )
254
255
{
255
256
key . ResultTransformer . SupplyAutoDiscoveredParameters ( queryParameters [ i ] . ResultTransformer , aliases ) ;
256
257
}
@@ -371,7 +372,8 @@ private static List<object> GetCacheableResult(
371
372
ICacheAssembler [ ] returnTypes ,
372
373
ISessionImplementor session ,
373
374
IList result ,
374
- long ts , string [ ] aliases )
375
+ long ts ,
376
+ string [ ] aliases )
375
377
{
376
378
var cacheable =
377
379
new List < object > ( result . Count + 1 )
@@ -407,9 +409,9 @@ private static long GetResultsMetadata(IList cacheable, out string[] aliases)
407
409
return ( long ) metadataArray [ 0 ] ;
408
410
}
409
411
410
- private static bool HasResults ( IList cacheable )
412
+ private static bool IsEmpty ( IList cacheable )
411
413
// First element is the timestamp.
412
- => cacheable . Count > 1 ;
414
+ => cacheable . Count <= 1 ;
413
415
414
416
private static IEnumerable < object > GetResultsEnumerable ( IList cacheable )
415
417
{
@@ -425,7 +427,7 @@ private static ICacheAssembler[] GetReturnTypes(
425
427
ICacheAssembler [ ] returnTypes ,
426
428
IList cacheable )
427
429
{
428
- var hasResults = HasResults ( cacheable ) ;
430
+ var hasResults = ! IsEmpty ( cacheable ) ;
429
431
if ( key . ResultTransformer ? . AutoDiscoverTypes == true && hasResults )
430
432
{
431
433
returnTypes = GuessTypes ( cacheable ) ;
@@ -444,7 +446,7 @@ private static void PerformBeforeAssemble(
444
446
ISessionImplementor session ,
445
447
IList cacheable )
446
448
{
447
- if ( ! HasResults ( cacheable ) )
449
+ if ( IsEmpty ( cacheable ) )
448
450
return ;
449
451
450
452
if ( returnTypes . Length == 1 )
@@ -475,7 +477,7 @@ private IList PerformAssemble(
475
477
try
476
478
{
477
479
var result = new List < object > ( cacheable . Count - 1 ) ;
478
- if ( ! HasResults ( cacheable ) )
480
+ if ( IsEmpty ( cacheable ) )
479
481
return result ;
480
482
481
483
if ( returnTypes . Length == 1 )
@@ -531,7 +533,7 @@ private static void InitializeCollections(
531
533
IList assembleResult ,
532
534
IList cacheResult )
533
535
{
534
- if ( ! HasResults ( cacheResult ) )
536
+ if ( IsEmpty ( cacheResult ) )
535
537
return ;
536
538
537
539
var collectionIndexes = new Dictionary < int , ICollectionPersister > ( ) ;
@@ -572,7 +574,7 @@ private IList GetResultFromCacheable(
572
574
{
573
575
Log . Debug ( "returning cached query results for: {0}" , key ) ;
574
576
575
- if ( ! HasResults ( cacheable ) )
577
+ if ( IsEmpty ( cacheable ) )
576
578
return new List < object > ( ) ;
577
579
578
580
returnTypes = GetReturnTypes ( key , returnTypes , cacheable ) ;
0 commit comments