4
4
// Created by: Alexander Nikolaev
5
5
// Created: 2009.10.20
6
6
7
- using System ;
8
- using System . Collections . Generic ;
9
- using System . Linq ;
10
7
using Xtensive . Collections ;
11
8
using Xtensive . Core ;
12
9
using Xtensive . Orm . Model ;
@@ -33,11 +30,17 @@ public override bool Equals(object obj) =>
33
30
34
31
// Constructors
35
32
36
- public RecordSetCacheKey ( IReadOnlyList < ColNum > columnIndexes , TypeInfo type , int cachedHashCode )
33
+ public RecordSetCacheKey ( IReadOnlyList < ColNum > columnIndexes , TypeInfo type )
37
34
{
38
35
ColumnIndexes = columnIndexes ;
39
36
Type = type ;
40
- this . cachedHashCode = cachedHashCode ;
37
+
38
+ HashCode hashCode = new ( ) ;
39
+ foreach ( var columnIndex in columnIndexes ) {
40
+ hashCode . Add ( columnIndex ) ;
41
+ }
42
+ hashCode . Add ( type ) ;
43
+ cachedHashCode = hashCode . ToHashCode ( ) ;
41
44
}
42
45
}
43
46
@@ -125,7 +128,7 @@ private QueryTask CreateQueryTask(List<Tuple> currentKeySet)
125
128
var parameterContext = new ParameterContext ( ) ;
126
129
parameterContext . SetValue ( includeParameter , currentKeySet ) ;
127
130
var session = manager . Owner . Session ;
128
- Provider = session . StorageNode . EntityFetchQueryCache . GetOrAdd ( cacheKey , CreateRecordSet ) ;
131
+ Provider = manager . Owner . Session . Domain . EntityFetchQueryCache . GetOrAdd ( cacheKey , static k => CreateRecordSet ( k ) ) ;
129
132
if ( session . Domain . TagsEnabled && session . Tags != null ) {
130
133
foreach ( var tag in session . Tags ) {
131
134
Provider = new TagProvider ( Provider , tag ) ;
@@ -192,13 +195,7 @@ public EntityGroupTask(TypeInfo type, IReadOnlyList<ColNum> columnIndexes, Prefe
192
195
193
196
this . type = type ;
194
197
this . manager = manager ;
195
- var cachedHashCode = 0 ;
196
- foreach ( var columnIndex in columnIndexes ) {
197
- cachedHashCode = unchecked ( 379 * cachedHashCode + columnIndex ) ;
198
- }
199
-
200
- cachedHashCode ^= type . GetHashCode ( ) ;
201
- cacheKey = new RecordSetCacheKey ( columnIndexes , type , cachedHashCode ) ;
198
+ cacheKey = new RecordSetCacheKey ( columnIndexes , type ) ;
202
199
}
203
200
}
204
201
}
0 commit comments