mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00
enable disposing ITypeResolver
This commit is contained in:

committed by
Patrik Svensson

parent
1ed7e65fcb
commit
6bceac8a5e
@ -4,7 +4,7 @@ using Spectre.Console.Cli;
|
||||
|
||||
namespace Injection
|
||||
{
|
||||
public sealed class TypeResolver : ITypeResolver
|
||||
public sealed class TypeResolver : ITypeResolver, IDisposable
|
||||
{
|
||||
private readonly IServiceProvider _provider;
|
||||
|
||||
@ -17,5 +17,13 @@ namespace Injection
|
||||
{
|
||||
return _provider.GetRequiredService(type);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_provider is IDisposable disposable)
|
||||
{
|
||||
disposable.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user