replace type name with type

This commit is contained in:
Maksim Chegulov 2021-10-22 13:08:09 +03:00
parent 9541b9e6b4
commit 018c1939ab
2 changed files with 7 additions and 6 deletions

View File

@ -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();
}

View File

@ -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<string, bool> _historyStore
= new ConcurrentDictionary<string, bool>();
private ConcurrentDictionary<Type, bool> _historyStore
= new ConcurrentDictionary<Type, bool>();
public bool TryAddMigratedContext(string contextTypeName)
public bool TryAddMigratedContext(Type contextType)
{
return _historyStore.TryAdd(contextTypeName, true);
return _historyStore.TryAdd(contextType, true);
}
}
}