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
Activity
Show:
Frédéric Delaporte February 22, 2017 at 1:33 AM
Edited
Well, rebasing my forked master was easy, but then rebasing my branch was yielding an ugly history, I have ended up merging. (I am not used to git.)
When a
FutureValue
has to call itsExecuteOnEval
delegate, it fails with an unable to convert exception from a scalar/entity to aIQueryable
of the scalar/entity.Current 5.0.0 code base seems to affect
ExecuteOnEval
only when Value is obtained fromFirst/FirstOrDefault/Single/SingleOrDefault
, like insession.Query<DomainClass>().Select(e => e.Id).ToFutureValue(q => q.FirstOrDefault()).Value
This is done by
ProcessFirstOrSingleBase
fromResultOperatorProcessors
namespace. It defines aPostExecuteTransformer
on theIntermediateHqlTree
taking anIQueryable
as input and yielding the scalar/entity as output. This transformer ends up affected toExecuteOnEval
.But current implementation of
FutureValue
callExecuteOnEval
on a scalar/entity value instead of anIQueryable
.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 likeCount/Min/Max/Sum
, which has caused someFutureValue
tests to start failing due to this bug withFutureValue
andPostExecuteTransformer
.)