@@ -122,7 +122,7 @@ public override async Task ListAsync(IQueryExpression queryExpression, QueryPara
122
122
}
123
123
}
124
124
125
- public override async Task ListAsync ( CriteriaImpl criteria , IList results , CancellationToken cancellationToken )
125
+ public override async Task < IList < T > > ListAsync < T > ( CriteriaImpl criteria , CancellationToken cancellationToken )
126
126
{
127
127
cancellationToken . ThrowIfCancellationRequested ( ) ;
128
128
using ( BeginProcess ( ) )
@@ -133,18 +133,16 @@ public override async Task ListAsync(CriteriaImpl criteria, IList results, Cance
133
133
CriteriaLoader [ ] loaders = new CriteriaLoader [ size ] ;
134
134
for ( int i = 0 ; i < size ; i ++ )
135
135
{
136
- loaders [ i ] = new CriteriaLoader ( GetOuterJoinLoadable ( implementors [ i ] ) , Factory ,
136
+ loaders [ size - 1 - i ] = new CriteriaLoader ( GetOuterJoinLoadable ( implementors [ i ] ) , Factory ,
137
137
criteria , implementors [ i ] , EnabledFilters ) ;
138
138
}
139
139
140
140
bool success = false ;
141
141
try
142
142
{
143
- for ( int i = size - 1 ; i >= 0 ; i -- )
144
- {
145
- ArrayHelper . AddAll ( results , await ( loaders [ i ] . ListAsync ( this , cancellationToken ) ) . ConfigureAwait ( false ) ) ;
146
- }
143
+ var results = await ( loaders . LoadAllToListAsync < T > ( this , cancellationToken ) ) . ConfigureAwait ( false ) ;
147
144
success = true ;
145
+ return results ;
148
146
}
149
147
catch ( OperationCanceledException ) { throw ; }
150
148
catch ( HibernateException )
@@ -159,11 +157,18 @@ public override async Task ListAsync(CriteriaImpl criteria, IList results, Cance
159
157
finally
160
158
{
161
159
await ( AfterOperationAsync ( success , cancellationToken ) ) . ConfigureAwait ( false ) ;
160
+ temporaryPersistenceContext . Clear ( ) ;
162
161
}
163
- temporaryPersistenceContext . Clear ( ) ;
164
162
}
165
163
}
166
164
165
+ //TODO 6.0: Remove (use base class implementation)
166
+ public override async Task ListAsync ( CriteriaImpl criteria , IList results , CancellationToken cancellationToken )
167
+ {
168
+ cancellationToken . ThrowIfCancellationRequested ( ) ;
169
+ ArrayHelper . AddAll ( results , await ( ListAsync ( criteria , cancellationToken ) ) . ConfigureAwait ( false ) ) ;
170
+ }
171
+
167
172
public override Task < IEnumerable > EnumerableAsync ( IQueryExpression queryExpression , QueryParameters queryParameters , CancellationToken cancellationToken )
168
173
{
169
174
throw new NotImplementedException ( ) ;
0 commit comments