@@ -14,7 +14,7 @@ namespace NHibernate
1414 /// <summary>
1515 /// Base class for both ICriteria and IQuery queries
1616 /// </summary>
17- public abstract partial class MultiAnyQueryBase < TResult > : IMultiAnyQuery , IMultiAnyQuery < TResult >
17+ public abstract partial class MultiAnyQueryBase < TResult > : IMultiAnyQuery < TResult >
1818 {
1919 protected ISessionImplementor Session ;
2020 private List < object > [ ] _hydratedObjects ;
@@ -45,9 +45,9 @@ public virtual void Init(ISessionImplementor session)
4545 _queryInfos = GetQueryLoadInfo ( ) ;
4646
4747 var count = _queryInfos . Count ;
48- NewArray ( count , out _hydratedObjects ) ;
49- NewArray ( count , out _subselectResultKeys ) ;
50- NewArray ( count , out _loaderResults ) ;
48+ _hydratedObjects = new List < object > [ count ] ;
49+ _subselectResultKeys = new List < EntityKey [ ] > [ count ] ;
50+ _loaderResults = new IList [ count ] ;
5151 }
5252
5353 public IEnumerable < ISqlCommand > GetCommands ( )
@@ -100,7 +100,6 @@ public IEnumerable<Func<DbDataReader, int>> GetProcessResultSetActions()
100100 int maxRows = Loader . Loader . HasMaxRows ( selection ) ? selection . MaxRows : int . MaxValue ;
101101 bool advanceSelection = ! dialect . SupportsLimitOffset || ! loader . UseLimit ( selection , dialect ) ;
102102
103- var tmpResults = new List < object > ( ) ;
104103 var index = i ;
105104 yield return reader =>
106105 {
@@ -117,6 +116,7 @@ public IEnumerable<Func<DbDataReader, int>> GetProcessResultSetActions()
117116 LockMode [ ] lockModeArray = loader . GetLockModes ( queryParameters . LockModes ) ;
118117 EntityKey optionalObjectKey = Loader . Loader . GetOptionalObjectKey ( queryParameters , Session ) ;
119118 int rowCount = 0 ;
119+ var tmpResults = new List < object > ( ) ;
120120
121121 int count ;
122122 for ( count = 0 ; count < maxRows && reader . Read ( ) ; count ++ )
@@ -143,10 +143,9 @@ public IEnumerable<Func<DbDataReader, int>> GetProcessResultSetActions()
143143
144144 tmpResults . Add ( o ) ;
145145 }
146+ _loaderResults [ index ] = tmpResults ;
146147 return rowCount ;
147148 } ;
148-
149- _loaderResults [ index ] = tmpResults ;
150149 }
151150 }
152151
@@ -208,10 +207,5 @@ public IList<TResult> GetResults()
208207 }
209208
210209 protected abstract List < TResult > DoGetResults ( ) ;
211-
212- private static void NewArray < T > ( int count , out T [ ] list )
213- {
214- list = new T [ count ] ;
215- }
216210 }
217211}
0 commit comments