/// <summary> /// Execute an SQL query and attempt to instantiate instances of the class mapped by the given /// persister from each row of the <c>DataReader</c>. If an object is supplied, will attempt to /// initialize that object. If a collection is supplied, attempt to initialize that collection. /// </summary> /// <param name="session"></param> /// <param name="queryParameters"></param> /// <param name="optionalObject"></param> /// <param name="optionalId"></param> /// <param name="optionalCollectionKeys"></param> /// <param name="returnProxies"></param> /// <returns></returns> private IList DoQueryAndInitializeNonLazyCollections( ISessionImplementor session, QueryParameters queryParameters, object optionalObject, object optionalId, object[ ] optionalCollectionKeys, bool returnProxies ) { session.BeforeLoad(); IList result; try { result = DoQuery( session, queryParameters, optionalObject, optionalId, optionalCollectionKeys, returnProxies ); } finally { session.AfterLoad(); } session.InitializeNonLazyCollections(); return result; }