We're updating the issue view to help you get more done. 

FutureValue fails on Linq queries defining a PostExecuteTransformer

Description

When a FutureValue has to call its ExecuteOnEval delegate, it fails with an unable to convert exception from a scalar/entity to a IQueryable of the scalar/entity.

Current 5.0.0 code base seems to affect ExecuteOnEval only when Value is obtained from First/FirstOrDefault/Single/SingleOrDefault, like in
session.Query<DomainClass>().Select(e => e.Id).ToFutureValue(q => q.FirstOrDefault()).Value
This is done by ProcessFirstOrSingleBase from ResultOperatorProcessors namespace. It defines a PostExecuteTransformer on the IntermediateHqlTree taking an IQueryable as input and yielding the scalar/entity as output. This transformer ends up affected to ExecuteOnEval.

But current implementation of FutureValue call ExecuteOnEval on a scalar/entity value instead of an IQueryable.

This trouble was discovered while attempting to solve NH-3850. (The solution I am working on for this other bug involves adding PostExecuteTransformer for scalar queries like Count/Min/Max/Sum, which has caused some FutureValue tests to start failing due to this bug with FutureValue and PostExecuteTransformer.)

Environment

None

Status

Assignee

Unassigned

Reporter

Frédéric Delaporte

Components

Fix versions

Affects versions

4.1.1

Priority

Minor