Skip to content

Commit 401377b

Browse files
committed
Make SessionFactoryImpl.implementorToEntityName a ReadOnlyDictionary to line up with how collectionMetadata is built and improve determistic behavior under accidental multithreading
1 parent 96218d1 commit 401377b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/NHibernate/Impl/SessionFactoryImpl.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
266266

267267
var caches = new Dictionary<Tuple<string, string>, ICacheConcurrencyStrategy>();
268268
var tmpEntityPersisters = new Dictionary<string, IEntityPersister>();
269-
implementorToEntityName = new Dictionary<System.Type, string>();
269+
var tmpImplementorToEntityName = new Dictionary<System.Type, string>();
270270

271271
Dictionary<string, IClassMetadata> classMeta = new Dictionary<string, IClassMetadata>();
272272

@@ -285,11 +285,12 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
285285

286286
if (model.HasPocoRepresentation)
287287
{
288-
implementorToEntityName[model.MappedClass] = model.EntityName;
288+
tmpImplementorToEntityName[model.MappedClass] = model.EntityName;
289289
}
290290
}
291291

292292
entityPersisters = new ReadOnlyDictionary<string, IEntityPersister>(tmpEntityPersisters);
293+
implementorToEntityName = new ReadOnlyDictionary<System.Type, string>(tmpImplementorToEntityName);
293294

294295
entityPersistersSpaces = entityPersisters
295296
.SelectMany(x => x.Value.QuerySpaces.Select(y => new { QuerySpace = y, Persister = x.Value }))

0 commit comments

Comments
 (0)