diff --git a/src/YesSql.Core/Indexes/IdentityMap.cs b/src/YesSql.Core/Indexes/IdentityMap.cs index fd216bef..07d85db7 100644 --- a/src/YesSql.Core/Indexes/IdentityMap.cs +++ b/src/YesSql.Core/Indexes/IdentityMap.cs @@ -25,8 +25,8 @@ public bool HasEntity(object entity) public void AddEntity(long id, object entity) { - _entities.Add(entity, id); - _documentIds.Add(id, entity); + _entities.TryAdd(entity, id); + _documentIds.TryAdd(id, entity); } public void AddDocument(Document doc)