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>
@@ -68,10 +76,8 @@ protected override IQueryExpression ExpandParameters(IDictionary<string, TypedVa
68
76
69
77
//TODO: Do we need to translate expression one more time here?
70
78
// This is not much an issue anymore: ExpressionQueryImpl are currently created only with NhLinqExpression
71
- // which do cache their translation. By the way, the false transmitted below as filter parameter to
72
- // Translate is wrong, since this ExpandParameters may also be called from ExpressionFilterImpl.
73
- // But that does not matter for NhLinqExpression.
74
- var newTree = ParameterExpander . Expand ( QueryExpression . Translate ( Session . Factory , false ) , map ) ;
79
+ // which do cache their translation.
80
+ var newTree = ParameterExpander . Expand ( QueryExpression . Translate ( Session . Factory , _isFilter ) , map ) ;
75
81
var key = new StringBuilder ( QueryExpression . Key ) ;
76
82
77
83
foreach ( var pair in map )
@@ -87,12 +93,12 @@ protected override IQueryExpression ExpandParameters(IDictionary<string, TypedVa
87
93
}
88
94
}
89
95
90
- partial class ExpressionFilterImpl : ExpressionQueryImpl
96
+ internal partial class ExpressionFilterImpl : ExpressionQueryImpl
91
97
{
92
98
private readonly object collection ;
93
99
94
100
public ExpressionFilterImpl ( IQueryExpression queryExpression , object collection , ISessionImplementor session , ParameterMetadata parameterMetadata )
95
- : base ( queryExpression , session , parameterMetadata )
101
+ : base ( queryExpression , session , parameterMetadata , true )
96
102
{
97
103
this . collection = collection ;
98
104
}
0 commit comments