优化Dispose方法清楚缓存数据
This commit is contained in:
parent
7b9ba185fc
commit
7373763e9f
|
@ -428,6 +428,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
|
||||||
{
|
{
|
||||||
dataSourceDbContext.Value.Dispose();
|
dataSourceDbContext.Value.Dispose();
|
||||||
}
|
}
|
||||||
|
_dataSourceDbContexts.Clear();
|
||||||
}
|
}
|
||||||
#if !EFCORE2
|
#if !EFCORE2
|
||||||
public async ValueTask DisposeAsync()
|
public async ValueTask DisposeAsync()
|
||||||
|
@ -436,6 +437,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
|
||||||
{
|
{
|
||||||
await dataSourceDbContext.Value.DisposeAsync();
|
await dataSourceDbContext.Value.DisposeAsync();
|
||||||
}
|
}
|
||||||
|
_dataSourceDbContexts.Clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,6 +279,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
|
||||||
{
|
{
|
||||||
dbContextCache.Value.Dispose();
|
dbContextCache.Value.Dispose();
|
||||||
}
|
}
|
||||||
|
_dbContextCaches.Clear();
|
||||||
}
|
}
|
||||||
#if !EFCORE2
|
#if !EFCORE2
|
||||||
|
|
||||||
|
@ -374,6 +375,7 @@ namespace ShardingCore.Sharding.ShardingDbContextExecutors
|
||||||
{
|
{
|
||||||
await dbContextCache.Value.DisposeAsync();
|
await dbContextCache.Value.DisposeAsync();
|
||||||
}
|
}
|
||||||
|
_dbContextCaches.Clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue