File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/NHibernate/Linq/Visitors Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1818using System ;
1919using System . Linq ;
2020using System . Linq . Expressions ;
21+ using System . Reflection ;
2122using NHibernate . Collection ;
2223using NHibernate . Engine ;
24+ using NHibernate . Impl ;
2325using NHibernate . Linq . Functions ;
2426using NHibernate . Util ;
2527using Remotion . Linq . Parsing ;
@@ -143,13 +145,14 @@ private Expression EvaluateSubtree(Expression subtree)
143145
144146 return constantExpression ;
145147 }
146- else
147- {
148- Expression < Func < object > > lambdaWithoutParameters = Expression . Lambda < Func < object > > ( Expression . Convert ( subtree , typeof ( object ) ) ) ;
149- var compiledLambda = lambdaWithoutParameters . Compile ( ) ;
150148
151- object value = compiledLambda ( ) ;
152- return Expression . Constant ( value , subtree . Type ) ;
149+ try
150+ {
151+ return Expression . Constant ( ExpressionProcessor . FindValue ( subtree ) , subtree . Type ) ;
152+ }
153+ catch ( TargetInvocationException ex )
154+ {
155+ throw ReflectHelper . UnwrapTargetInvocationException ( ex ) ;
153156 }
154157 }
155158
You can’t perform that action at this time.
0 commit comments