public override IList GetResultList(IList results, IResultTransformer resultTransformer) { // meant to handle dynamic instantiation queries... HolderInstantiator holderInstantiator = HolderInstantiator.GetHolderInstantiator(_selectNewTransformer, resultTransformer, _queryReturnAliases); if (holderInstantiator.IsRequired) { for (int i = 0; i < results.Count; i++) { var row = (Object[])results[i]; Object result = holderInstantiator.Instantiate(row); results[i] = result; } if (!HasSelectNew && resultTransformer != null) { return(resultTransformer.TransformList(results)); } else { return(results); } } else { return(results); } }
internal async Task <IEnumerable> GetEnumerableAsync(QueryParameters queryParameters, IEventSource session, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); CheckQuery(queryParameters); bool statsEnabled = session.Factory.Statistics.IsStatisticsEnabled; var stopWath = new Stopwatch(); if (statsEnabled) { stopWath.Start(); } var cmd = await(PrepareQueryCommandAsync(queryParameters, false, session, cancellationToken)).ConfigureAwait(false); // This DbDataReader is disposed of in EnumerableImpl.Dispose var rs = await(GetResultSetAsync(cmd, queryParameters.HasAutoDiscoverScalarTypes, false, queryParameters.RowSelection, session, cancellationToken)).ConfigureAwait(false); HolderInstantiator hi = HolderInstantiator.GetHolderInstantiator(_selectNewTransformer, queryParameters.ResultTransformer, _queryReturnAliases); IEnumerable result = new EnumerableImpl(rs, cmd, session, queryParameters.IsReadOnly(session), _queryTranslator.ReturnTypes, _queryTranslator.GetColumnNames(), queryParameters.RowSelection, hi); if (statsEnabled) { stopWath.Stop(); session.Factory.StatisticsImplementor.QueryExecuted("HQL: " + _queryTranslator.QueryString, 0, stopWath.Elapsed); // NH: Different behavior (H3.2 use QueryLoader in AST parser) we need statistic for orginal query too. // probably we have a bug some where else for statistic RowCount session.Factory.StatisticsImplementor.QueryExecuted(QueryIdentifier, 0, stopWath.Elapsed); } return(result); }
internal IEnumerable GetEnumerable(QueryParameters queryParameters, IEventSource session) { CheckQuery(queryParameters); bool statsEnabled = session.Factory.Statistics.IsStatisticsEnabled; var stopWath = new Stopwatch(); if (statsEnabled) { stopWath.Start(); } var cmd = PrepareQueryCommand(queryParameters, false, session); // This DbDataReader is disposed of in EnumerableImpl.Dispose var rs = GetResultSet(cmd, queryParameters, session, null); HolderInstantiator hi = HolderInstantiator.GetHolderInstantiator(_selectNewTransformer, queryParameters.ResultTransformer, _queryReturnAliases); IEnumerable result = new EnumerableImpl(rs, cmd, session, queryParameters.IsReadOnly(session), _queryTranslator.ReturnTypes, _queryTranslator.GetColumnNames(), queryParameters.RowSelection, hi); if (statsEnabled) { stopWath.Stop(); session.Factory.StatisticsImplementor.QueryExecuted("HQL: " + _queryTranslator.QueryString, 0, stopWath.Elapsed); // NH: Different behavior (H3.2 use QueryLoader in AST parser) we need statistic for orginal query too. // probably we have a bug some where else for statistic RowCount session.Factory.StatisticsImplementor.QueryExecuted(QueryIdentifier, 0, stopWath.Elapsed); } return(result); }
public override IList GetResultList(IList results, IResultTransformer resultTransformer) { // meant to handle dynamic instantiation queries...(Copy from QueryLoader) HolderInstantiator holderInstantiator = HolderInstantiator.GetHolderInstantiator(null, resultTransformer, ReturnAliasesForTransformer); if (holderInstantiator.IsRequired) { for (int i = 0; i < results.Count; i++) { object[] row = (object[])results[i]; object result = holderInstantiator.Instantiate(row); results[i] = result; } return(resultTransformer.TransformList(results)); } else { return(results); } }