1
- using System ;
2
1
using System . Collections ;
3
2
using System . Collections . Generic ;
4
3
using System . Linq ;
@@ -21,8 +20,17 @@ public ExpressionQueryImpl(IQueryExpression queryExpression, ISessionImplementor
21
20
QueryExpression = queryExpression ;
22
21
}
23
22
23
+ protected ExpressionQueryImpl (
24
+ IQueryExpression queryExpression , ISessionImplementor session , ParameterMetadata parameterMetadata , bool isFilter )
25
+ : this ( queryExpression , session , parameterMetadata )
26
+ {
27
+ _isFilter = isFilter ;
28
+ }
29
+
24
30
public IQueryExpression QueryExpression { get ; private set ; }
25
31
32
+ protected readonly bool _isFilter ;
33
+
26
34
/// <summary>
27
35
/// Warning: adds new parameters to the argument by side-effect, as well as mutating the query expression tree!
28
36
/// </summary>
@@ -75,10 +83,8 @@ protected override IQueryExpression ExpandParameters(IDictionary<string, TypedVa
75
83
76
84
//TODO: Do we need to translate expression one more time here?
77
85
// This is not much an issue anymore: ExpressionQueryImpl are currently created only with NhLinqExpression
78
- // which do cache their translation. By the way, the false transmitted below as filter parameter to
79
- // Translate is wrong, since this ExpandParameters may also be called from ExpressionFilterImpl.
80
- // But that does not matter for NhLinqExpression.
81
- var newTree = ParameterExpander . Expand ( QueryExpression . Translate ( Session . Factory , false ) , map ) ;
86
+ // which do cache their translation.
87
+ var newTree = ParameterExpander . Expand ( QueryExpression . Translate ( Session . Factory , _isFilter ) , map ) ;
82
88
var key = new StringBuilder ( QueryExpression . Key ) ;
83
89
84
90
foreach ( var pair in map )
@@ -94,12 +100,12 @@ protected override IQueryExpression ExpandParameters(IDictionary<string, TypedVa
94
100
}
95
101
}
96
102
97
- partial class ExpressionFilterImpl : ExpressionQueryImpl
103
+ internal partial class ExpressionFilterImpl : ExpressionQueryImpl
98
104
{
99
105
private readonly object collection ;
100
106
101
107
public ExpressionFilterImpl ( IQueryExpression queryExpression , object collection , ISessionImplementor session , ParameterMetadata parameterMetadata )
102
- : base ( queryExpression , session , parameterMetadata )
108
+ : base ( queryExpression , session , parameterMetadata , true )
103
109
{
104
110
this . collection = collection ;
105
111
}
0 commit comments