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 18
18
using System ;
19
19
using System . Linq ;
20
20
using System . Linq . Expressions ;
21
+ using System . Reflection ;
21
22
using NHibernate . Collection ;
22
23
using NHibernate . Engine ;
24
+ using NHibernate . Impl ;
23
25
using NHibernate . Linq . Functions ;
24
26
using NHibernate . Util ;
25
27
using Remotion . Linq . Parsing ;
@@ -143,13 +145,14 @@ private Expression EvaluateSubtree(Expression subtree)
143
145
144
146
return constantExpression ;
145
147
}
146
- else
147
- {
148
- Expression < Func < object > > lambdaWithoutParameters = Expression . Lambda < Func < object > > ( Expression . Convert ( subtree , typeof ( object ) ) ) ;
149
- var compiledLambda = lambdaWithoutParameters . Compile ( ) ;
150
148
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 ) ;
153
156
}
154
157
}
155
158
You can’t perform that action at this time.
0 commit comments