From 018c1939ab441872edfb7492020c8a3a753f33fa Mon Sep 17 00:00:00 2001 From: MaksimChegulov Date: Fri, 22 Oct 2021 13:08:09 +0300 Subject: [PATCH] replace type name with type --- common/ASC.Core.Common/EF/Context/DbContextManager.cs | 2 +- common/ASC.Core.Common/EF/MigrationHistory.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/ASC.Core.Common/EF/Context/DbContextManager.cs b/common/ASC.Core.Common/EF/Context/DbContextManager.cs index 6e720c513e..690367553b 100644 --- a/common/ASC.Core.Common/EF/Context/DbContextManager.cs +++ b/common/ASC.Core.Common/EF/Context/DbContextManager.cs @@ -36,7 +36,7 @@ namespace ASC.Core.Common.EF if (t is BaseDbContext dbContext) { if (Configuration["migration:enabled"] == "true" - && MigrationHistory.TryAddMigratedContext(t.ToString())) + && MigrationHistory.TryAddMigratedContext(t.GetType())) { dbContext.Migrate(); } diff --git a/common/ASC.Core.Common/EF/MigrationHistory.cs b/common/ASC.Core.Common/EF/MigrationHistory.cs index 5d252f5a6c..49b812d4c9 100644 --- a/common/ASC.Core.Common/EF/MigrationHistory.cs +++ b/common/ASC.Core.Common/EF/MigrationHistory.cs @@ -1,4 +1,5 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; using ASC.Common; @@ -7,12 +8,12 @@ namespace ASC.Core.Common.EF [Singletone] public class MigrationHistory { - private ConcurrentDictionary _historyStore - = new ConcurrentDictionary(); + private ConcurrentDictionary _historyStore + = new ConcurrentDictionary(); - public bool TryAddMigratedContext(string contextTypeName) + public bool TryAddMigratedContext(Type contextType) { - return _historyStore.TryAdd(contextTypeName, true); + return _historyStore.TryAdd(contextType, true); } } }