@@ -330,19 +330,7 @@ protected void ProcessJoins()
330
330
while ( joinQueue . Count > 0 )
331
331
{
332
332
QueueEntry entry = joinQueue . Dequeue ( ) ;
333
-
334
- switch ( entry )
335
- {
336
- case CollectionQueueEntry ce :
337
- WalkCollectionTree ( ce . Persister , ce . Alias , ce . Path , ce . PathAlias ) ;
338
- break ;
339
- case EntityQueueEntry eqe :
340
- WalkEntityTree ( eqe . Persister , eqe . Alias , eqe . Path ) ;
341
- break ;
342
- default :
343
- depth ++ ;
344
- break ;
345
- }
333
+ entry . Walk ( this , ref depth ) ;
346
334
}
347
335
}
348
336
@@ -491,7 +479,7 @@ protected virtual void WalkEntityTree(IOuterJoinLoadable persister, string alias
491
479
{
492
480
int n = persister . CountSubclassProperties ( ) ;
493
481
494
- joinQueue . Enqueue ( null ) ;
482
+ joinQueue . Enqueue ( NextLevelQueueEntry . Instance ) ;
495
483
for ( int i = 0 ; i < n ; i ++ )
496
484
{
497
485
IType type = persister . GetSubclassPropertyType ( i ) ;
@@ -1272,23 +1260,52 @@ protected static string GetSelectFragment(OuterJoinableAssociation join, string
1272
1260
return join . GetSelectFragment ( entitySuffix , collectionSuffix , next ) ;
1273
1261
}
1274
1262
1275
- protected abstract class QueueEntry { }
1263
+ protected abstract class QueueEntry
1264
+ {
1265
+ public abstract void Walk ( JoinWalker walker , ref int depth ) ;
1266
+ }
1276
1267
1277
1268
protected abstract class QueueEntry < T > : QueueEntry where T : IJoinable
1278
1269
{
1279
1270
public string Alias { get ; set ; }
1280
1271
public T Persister { get ; set ; }
1281
1272
}
1282
1273
1283
- protected class EntityQueueEntry < T > : QueueEntry < T > where T : IJoinable
1274
+ protected abstract class EntityQueueEntry < T > : QueueEntry < T > where T : IJoinable
1284
1275
{
1285
1276
public string Path { get ; set ; }
1286
1277
}
1287
- protected class EntityQueueEntry : EntityQueueEntry < IOuterJoinLoadable > { }
1278
+
1279
+ protected class EntityQueueEntry : EntityQueueEntry < IOuterJoinLoadable >
1280
+ {
1281
+ public override void Walk ( JoinWalker walker , ref int depth )
1282
+ {
1283
+ walker . WalkEntityTree ( Persister , Alias , Path ) ;
1284
+ }
1285
+ }
1288
1286
1289
1287
protected class CollectionQueueEntry : EntityQueueEntry < IQueryableCollection >
1290
1288
{
1291
1289
public string PathAlias { get ; set ; }
1290
+
1291
+ public override void Walk ( JoinWalker walker , ref int depth )
1292
+ {
1293
+ walker . WalkCollectionTree ( Persister , Alias , Path , PathAlias ) ;
1294
+ }
1295
+ }
1296
+
1297
+ protected class NextLevelQueueEntry : QueueEntry
1298
+ {
1299
+ public static NextLevelQueueEntry Instance = new NextLevelQueueEntry ( ) ;
1300
+
1301
+ private NextLevelQueueEntry ( )
1302
+ {
1303
+ }
1304
+
1305
+ public override void Walk ( JoinWalker walker , ref int depth )
1306
+ {
1307
+ depth ++ ;
1308
+ }
1292
1309
}
1293
1310
}
1294
1311
}
0 commit comments