优化Dispose方法清楚缓存数据

This commit is contained in:
xuejiaming 2023-02-10 22:46:26 +08:00
parent 7b9ba185fc
commit 7373763e9f
2 changed files with 4 additions and 0 deletions

View File

@ -428,6 +428,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
{
dataSourceDbContext.Value.Dispose();
}
_dataSourceDbContexts.Clear();
}
#if !EFCORE2
public async ValueTask DisposeAsync()
@ -436,6 +437,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
{
await dataSourceDbContext.Value.DisposeAsync();
}
_dataSourceDbContexts.Clear();
}
#endif
}

View File

@ -279,6 +279,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
{
dbContextCache.Value.Dispose();
}
_dbContextCaches.Clear();
}
#if !EFCORE2
@ -374,6 +375,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
{
await dbContextCache.Value.DisposeAsync();
}
_dbContextCaches.Clear();
}
#endif