@@ -20,8 +20,8 @@ public partial class BulkOperationCleanupAction :
20
20
ICacheableExecutable
21
21
{
22
22
private readonly ISessionFactoryImplementor _factory ;
23
- private readonly HashSet < string > _affectedEntityNames = new HashSet < string > ( ) ;
24
- private readonly HashSet < string > _affectedCollectionRoles = new HashSet < string > ( ) ;
23
+ private readonly HashSet < string > _affectedEntityNames ;
24
+ private readonly HashSet < string > _affectedCollectionRoles ;
25
25
private readonly string [ ] _spaces ;
26
26
private readonly bool _hasCache ;
27
27
@@ -34,12 +34,22 @@ public BulkOperationCleanupAction(ISessionImplementor session, IQueryable[] affe
34
34
if ( queryables . HasCache )
35
35
{
36
36
_hasCache = true ;
37
+ if ( _affectedEntityNames == null )
38
+ {
39
+ _affectedEntityNames = new HashSet < string > ( ) ;
40
+ }
41
+
37
42
_affectedEntityNames . Add ( queryables . EntityName ) ;
38
43
}
39
44
40
45
var roles = _factory . GetCollectionRolesByEntityParticipant ( queryables . EntityName ) ;
41
46
if ( roles != null )
42
47
{
48
+ if ( _affectedCollectionRoles == null )
49
+ {
50
+ _affectedCollectionRoles = new HashSet < string > ( ) ;
51
+ }
52
+
43
53
_affectedCollectionRoles . UnionWith ( roles ) ;
44
54
}
45
55
@@ -56,6 +66,8 @@ public BulkOperationCleanupAction(ISessionImplementor session, ISet<string> quer
56
66
{
57
67
//from H3.2 TODO: cache the autodetected information and pass it in instead.
58
68
_factory = session . Factory ;
69
+ _affectedEntityNames = new HashSet < string > ( ) ;
70
+ _affectedCollectionRoles = new HashSet < string > ( ) ;
59
71
60
72
var tmpSpaces = new HashSet < string > ( querySpaces ) ;
61
73
var acmd = _factory . GetAllClassMetadata ( ) ;
@@ -70,12 +82,22 @@ public BulkOperationCleanupAction(ISessionImplementor session, ISet<string> quer
70
82
if ( persister . HasCache )
71
83
{
72
84
_hasCache = true ;
85
+ if ( _affectedEntityNames == null )
86
+ {
87
+ _affectedEntityNames = new HashSet < string > ( ) ;
88
+ }
89
+
73
90
_affectedEntityNames . Add ( persister . EntityName ) ;
74
91
}
75
92
76
93
var roles = session . Factory . GetCollectionRolesByEntityParticipant ( persister . EntityName ) ;
77
94
if ( roles != null )
78
95
{
96
+ if ( _affectedCollectionRoles == null )
97
+ {
98
+ _affectedCollectionRoles = new HashSet < string > ( ) ;
99
+ }
100
+
79
101
_affectedCollectionRoles . UnionWith ( roles ) ;
80
102
}
81
103
0 commit comments