@@ -37,28 +37,28 @@ public QueryParameters(IType[] positionalParameterTypes, object[] postionalParam
37
37
: this ( positionalParameterTypes , postionalParameterValues , null , collectionKeys ) { }
38
38
39
39
public QueryParameters ( IType [ ] positionalParameterTypes , object [ ] postionalParameterValues , IDictionary < string , TypedValue > namedParameters , object [ ] collectionKeys )
40
- : this ( positionalParameterTypes , postionalParameterValues , namedParameters , null , null , false , false , false , null , null , collectionKeys , null ) { }
40
+ : this ( positionalParameterTypes , postionalParameterValues , namedParameters , null , null , false , false , false , null , null , collectionKeys , null , true ) { }
41
41
42
42
public QueryParameters ( IType [ ] positionalParameterTypes , object [ ] positionalParameterValues , IDictionary < string , LockMode > lockModes , RowSelection rowSelection ,
43
- bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion , string comment , bool isLookupByNaturalKey , IResultTransformer transformer )
44
- : this ( positionalParameterTypes , positionalParameterValues , null , lockModes , rowSelection , isReadOnlyInitialized , readOnly , cacheable , cacheRegion , comment , null , transformer )
43
+ bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion , string comment , bool isLookupByNaturalKey , IResultTransformer transformer )
44
+ : this ( positionalParameterTypes , positionalParameterValues , null , lockModes , rowSelection , isReadOnlyInitialized , readOnly , cacheable , cacheRegion , comment , null , transformer , true )
45
45
{
46
46
NaturalKeyLookup = isLookupByNaturalKey ;
47
47
}
48
48
49
49
public QueryParameters ( IDictionary < string , TypedValue > namedParameters , IDictionary < string , LockMode > lockModes , RowSelection rowSelection , bool isReadOnlyInitialized ,
50
- bool readOnly , bool cacheable , string cacheRegion , string comment , bool isLookupByNaturalKey , IResultTransformer transformer )
50
+ bool readOnly , bool cacheable , string cacheRegion , string comment , bool isLookupByNaturalKey , IResultTransformer transformer , bool canAddCollectionsToCache )
51
51
: this (
52
52
TypeHelper . EmptyTypeArray , Array . Empty < object > ( ) , namedParameters , lockModes , rowSelection , isReadOnlyInitialized , readOnly , cacheable , cacheRegion , comment , null ,
53
- transformer )
53
+ transformer , canAddCollectionsToCache )
54
54
{
55
55
// used by CriteriaTranslator
56
56
NaturalKeyLookup = isLookupByNaturalKey ;
57
57
}
58
58
59
59
public QueryParameters ( IType [ ] positionalParameterTypes , object [ ] positionalParameterValues , IDictionary < string , TypedValue > namedParameters ,
60
- IDictionary < string , LockMode > lockModes , RowSelection rowSelection , bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion ,
61
- string comment , object [ ] collectionKeys , IResultTransformer transformer )
60
+ IDictionary < string , LockMode > lockModes , RowSelection rowSelection , bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion ,
61
+ string comment , object [ ] collectionKeys , IResultTransformer transformer , bool canAddCollectionsToCache )
62
62
{
63
63
PositionalParameterTypes = positionalParameterTypes ?? Array . Empty < IType > ( ) ;
64
64
PositionalParameterValues = positionalParameterValues ?? Array . Empty < object > ( ) ;
@@ -72,14 +72,15 @@ public QueryParameters(IType[] positionalParameterTypes, object[] positionalPara
72
72
IsReadOnlyInitialized = isReadOnlyInitialized ;
73
73
this . readOnly = readOnly ;
74
74
ResultTransformer = transformer ;
75
+ CanAddCollectionsToCache = canAddCollectionsToCache ;
75
76
}
76
77
77
78
public QueryParameters ( IType [ ] positionalParameterTypes , object [ ] positionalParameterValues , IDictionary < string , TypedValue > namedParameters ,
78
- IDictionary < string , LockMode > lockModes , RowSelection rowSelection , bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion ,
79
- string comment , object [ ] collectionKeys , object optionalObject , string optionalEntityName , object optionalId , IResultTransformer transformer )
79
+ IDictionary < string , LockMode > lockModes , RowSelection rowSelection , bool isReadOnlyInitialized , bool readOnly , bool cacheable , string cacheRegion ,
80
+ string comment , object [ ] collectionKeys , object optionalObject , string optionalEntityName , object optionalId , IResultTransformer transformer )
80
81
: this (
81
82
positionalParameterTypes , positionalParameterValues , namedParameters , lockModes , rowSelection , isReadOnlyInitialized , readOnly , cacheable , cacheRegion , comment , collectionKeys ,
82
- transformer )
83
+ transformer , true )
83
84
{
84
85
OptionalEntityName = optionalEntityName ;
85
86
OptionalId = optionalId ;
@@ -139,6 +140,11 @@ public bool HasRowSelection
139
140
140
141
public bool Callable { get ; set ; }
141
142
143
+ /// <summary>
144
+ /// Indicates if we can add loaded children collections to second lvl cache.
145
+ /// </summary>
146
+ public bool CanAddCollectionsToCache { get ; set ; }
147
+
142
148
public bool ReadOnly
143
149
{
144
150
get
@@ -196,7 +202,7 @@ public void ValidateParameters()
196
202
if ( typesLength != valuesLength )
197
203
{
198
204
throw new QueryException ( "Number of positional parameter types (" + typesLength
199
- + ") does not match number of positional parameter values (" + valuesLength + ")" ) ;
205
+ + ") does not match number of positional parameter values (" + valuesLength + ")" ) ;
200
206
}
201
207
}
202
208
0 commit comments