From 5efe425e803ab9e234e914dbec1f7a557d1f14b5 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Mon, 25 Nov 2024 16:27:01 -0800 Subject: [PATCH 1/3] Fix IdentityMap exception --- src/YesSql.Core/Indexes/IdentityMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/YesSql.Core/Indexes/IdentityMap.cs b/src/YesSql.Core/Indexes/IdentityMap.cs index fd216bef..980df957 100644 --- a/src/YesSql.Core/Indexes/IdentityMap.cs +++ b/src/YesSql.Core/Indexes/IdentityMap.cs @@ -26,7 +26,7 @@ public bool HasEntity(object entity) public void AddEntity(long id, object entity) { _entities.Add(entity, id); - _documentIds.Add(id, entity); + _documentIds[id] = entity; } public void AddDocument(Document doc) From 579eff0c0586cbac74de7819652c9b405d6be355 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Tue, 26 Nov 2024 13:06:00 -0800 Subject: [PATCH 2/3] Fix IdentityMap exception --- src/YesSql.Core/Indexes/IdentityMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/YesSql.Core/Indexes/IdentityMap.cs b/src/YesSql.Core/Indexes/IdentityMap.cs index 980df957..c37002b1 100644 --- a/src/YesSql.Core/Indexes/IdentityMap.cs +++ b/src/YesSql.Core/Indexes/IdentityMap.cs @@ -25,7 +25,7 @@ public bool HasEntity(object entity) public void AddEntity(long id, object entity) { - _entities.Add(entity, id); + _entities[entity] = id; _documentIds[id] = entity; } From 27536025e17e71f8dc04715665af9b503b28daa4 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Tue, 26 Nov 2024 13:10:04 -0800 Subject: [PATCH 3/3] use try add --- src/YesSql.Core/Indexes/IdentityMap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/YesSql.Core/Indexes/IdentityMap.cs b/src/YesSql.Core/Indexes/IdentityMap.cs index c37002b1..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[entity] = id; - _documentIds[id] = entity; + _entities.TryAdd(entity, id); + _documentIds.TryAdd(id, entity); } public void AddDocument(Document doc)