diff --git a/Slim.Tests/Models/IDisposableSingletonService.cs b/Slim.Tests/Models/IDisposableSingletonService.cs new file mode 100644 index 0000000..db68e2c --- /dev/null +++ b/Slim.Tests/Models/IDisposableSingletonService.cs @@ -0,0 +1,12 @@ +namespace Slim.Tests.Models +{ + public sealed class IDisposableSingletonService : IIDisposableService + { + public bool DisposeCalled { get; set; } + + public void Dispose() + { + this.DisposeCalled = true; + } + } +} diff --git a/Slim.Tests/Models/IIDisposableService.cs b/Slim.Tests/Models/IIDisposableService.cs index 3b79da3..0882921 100644 --- a/Slim.Tests/Models/IIDisposableService.cs +++ b/Slim.Tests/Models/IIDisposableService.cs @@ -4,5 +4,6 @@ namespace Slim.Tests.Models { public interface IIDisposableService : IDisposable { + bool DisposeCalled { get; set; } } } diff --git a/Slim.Tests/ServiceManagerTests.cs b/Slim.Tests/ServiceManagerTests.cs index b97c7ca..aef3af6 100644 --- a/Slim.Tests/ServiceManagerTests.cs +++ b/Slim.Tests/ServiceManagerTests.cs @@ -209,7 +209,7 @@ namespace Slim.Tests public void MultiInterfaceDeclarationReturnsSameSingleton() { var di = new ServiceManager(); - di.RegisterSingleton(); + di.RegisterSingleton(registerAllInterfaces: true); var singleton1 = di.GetService(); var singleton2 = di.GetService(); @@ -221,7 +221,7 @@ namespace Slim.Tests public void MultiInterfaceDeclarationReturnsDifferentTransient() { var di = new ServiceManager(); - di.RegisterTransient(); + di.RegisterTransient(registerAllInterfaces: true); var transient1 = di.GetService(); var transient2 = di.GetService(); @@ -233,7 +233,7 @@ namespace Slim.Tests public void MultiInterfaceDeclarationWithFactoryReturnsSameSingleton() { var di = new ServiceManager(); - di.RegisterSingleton(sp => new MultiInterfaceService()); + di.RegisterSingleton(sp => new MultiInterfaceService(), registerAllInterfaces: true); var singleton1 = di.GetService(); var singleton2 = di.GetService(); @@ -245,7 +245,7 @@ namespace Slim.Tests public void MultiInterfaceDeclarationWithFactoryReturnsDifferentTransient() { var di = new ServiceManager(); - di.RegisterTransient(sp => new MultiInterfaceService()); + di.RegisterTransient(sp => new MultiInterfaceService(), registerAllInterfaces: true); var transient1 = di.GetService(); var transient2 = di.GetService(); @@ -579,5 +579,68 @@ namespace Slim.Tests di.GetServicesOfType().Should().HaveCount(3); di.GetServicesOfType(typeof(ISharedInterface)).Should().HaveCount(3).And.AllBeAssignableTo(); } + + [TestMethod] + public void DisposingServiceManagerShouldDisposeInstances() + { + var di = new ServiceManager(); + di.RegisterSingleton(); + + var disposableService = di.GetService(); + di.Dispose(); + + disposableService.DisposeCalled.Should().BeTrue(); + } + + [TestMethod] + public void DisposingServiceManagerShouldDisposeAllServices() + { + var di = new ServiceManager(); + di.RegisterScoped(); + di.RegisterSingleton(); + + var disposableService = di.GetService(); + var disposableSingletonService = di.GetService(); + di.Dispose(); + + disposableSingletonService.DisposeCalled.Should().BeTrue(); + disposableService.DisposeCalled.Should().BeTrue(); + } + + [TestMethod] + public void DisposingScopedServiceManagerShouldDisposeOnlyScopedServices() + { + var di = new ServiceManager(); + di.RegisterScoped(); + di.RegisterSingleton(); + + var disposableSingletonService = di.GetService(); + var scopedDi = di.CreateScope(); + var disposableService = scopedDi.GetService(); + scopedDi.Dispose(); + + disposableSingletonService.DisposeCalled.Should().BeFalse(); + disposableService.DisposeCalled.Should().BeTrue(); + } + + [TestMethod] + public void RegisterAllInterfacesFalseShouldRegisterOnlyTypeOfObject() + { + var di = new ServiceManager(); + di.RegisterSingleton(); + + di.GetService().Should().NotBeNull(); + var action = new Action(() => + { + di.GetService(); + }); + var action2 = new Action(() => + { + di.GetService(); + }); + + action.Should().Throw(); + action2.Should().Throw(); + } } } diff --git a/Slim/IServiceManager.cs b/Slim/IServiceManager.cs index e991ebd..426af6c 100644 --- a/Slim/IServiceManager.cs +++ b/Slim/IServiceManager.cs @@ -22,7 +22,7 @@ namespace Slim /// /// Register the current service manager as a valid dependency. /// - /// Same functionality as calling with current . + /// Registers current service manager as , , , . void RegisterServiceManager(); /// /// Builds all registered singletons. diff --git a/Slim/IServiceProducer.cs b/Slim/IServiceProducer.cs index 0077339..3464a8f 100644 --- a/Slim/IServiceProducer.cs +++ b/Slim/IServiceProducer.cs @@ -11,55 +11,61 @@ namespace Slim /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterSingleton() + void RegisterSingleton(bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// /// Type of implementation. + /// If true, will register all interfaces implemented by the provided class./> /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterSingleton(Func serviceFactory) + void RegisterSingleton(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterTransient() + void RegisterTransient(bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterTransient(Func serviceFactory) + void RegisterTransient(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterScoped() + void RegisterScoped(bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterScoped(Func serviceFactory) + void RegisterScoped(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class; /// /// Register a service into with . @@ -173,49 +179,55 @@ namespace Slim /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterTransient(Type tClass); + void RegisterTransient(Type tClass, bool registerAllInterfaces = false); /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterTransient(Type tClass, Func serviceFactory); + void RegisterTransient(Type tClass, Func serviceFactory, bool registerAllInterfaces = false); /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterSingleton(Type tClass); + void RegisterSingleton(Type tClass, bool registerAllInterfaces = false); /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterSingleton(Type tClass, Func serviceFactory); + void RegisterSingleton(Type tClass, Func serviceFactory, bool registerAllInterfaces = false); /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - void RegisterScoped(Type tClass); + void RegisterScoped(Type tClass, bool registerAllInterfaces = false); /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - void RegisterScoped(Type tClass, Func serviceFactory); + void RegisterScoped(Type tClass, Func serviceFactory, bool registerAllInterfaces = false); } } diff --git a/Slim/IServiceProvider.cs b/Slim/IServiceProvider.cs index 079aaf1..f4ac3bc 100644 --- a/Slim/IServiceProvider.cs +++ b/Slim/IServiceProvider.cs @@ -1,11 +1,12 @@ -using Slim.Exceptions; +using System; +using Slim.Exceptions; namespace Slim { /// /// Interface allowing to request services from the . /// - public interface IServiceProvider : System.IServiceProvider + public interface IServiceProvider : System.IServiceProvider, IDisposable { /// /// Creates a scoped . diff --git a/Slim/ServiceManager.cs b/Slim/ServiceManager.cs index dace3bf..a4017a0 100644 --- a/Slim/ServiceManager.cs +++ b/Slim/ServiceManager.cs @@ -12,6 +12,9 @@ namespace Slim /// public sealed class ServiceManager : IServiceManager { + private bool disposedValue; + private readonly bool scoped = false; + private Dictionary InterfaceMapping { get; } = new Dictionary(); private Dictionary Instances { get; } = new Dictionary(); private Dictionary Factories { get; } = new Dictionary(); @@ -37,6 +40,7 @@ namespace Slim this.Factories = factories; this.ExceptionHandlers = exceptionHandlers; this.Resolvers = resolvers; + this.scoped = true; } /// @@ -217,157 +221,172 @@ namespace Slim /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterSingleton() where TClass : class + public void RegisterSingleton(bool registerAllInterfaces = false) where TClass : class { - this.RegisterService(typeof(TClass), Lifetime.Singleton); + this.RegisterService(typeof(TClass), Lifetime.Singleton, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterSingleton(Func serviceFactory) where TClass : class + public void RegisterSingleton(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class { if (serviceFactory is null) { throw new ArgumentNullException(nameof(serviceFactory)); } - this.RegisterService(typeof(TClass), Lifetime.Singleton, null, serviceFactory); + this.RegisterService(typeof(TClass), Lifetime.Singleton, null, serviceFactory, registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterTransient() where TClass : class + public void RegisterTransient(bool registerAllInterfaces = false) where TClass : class { - this.RegisterService(typeof(TClass), Lifetime.Transient); + this.RegisterService(typeof(TClass), Lifetime.Transient, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterTransient(Func serviceFactory) where TClass : class + public void RegisterTransient(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class { if (serviceFactory is null) { throw new ArgumentNullException(nameof(serviceFactory)); } - this.RegisterService(typeof(TClass), Lifetime.Transient, null, serviceFactory); + this.RegisterService(typeof(TClass), Lifetime.Transient, null, serviceFactory, registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterScoped() where TClass : class + public void RegisterScoped(bool registerAllInterfaces = false) where TClass : class { - this.RegisterService(typeof(TClass), Lifetime.Scoped); + this.RegisterService(typeof(TClass), Lifetime.Scoped, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for the implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterScoped(Func serviceFactory) where TClass : class + public void RegisterScoped(Func serviceFactory, bool registerAllInterfaces = false) where TClass : class { if (serviceFactory is null) { throw new ArgumentNullException(nameof(serviceFactory)); } - this.RegisterService(typeof(TClass), Lifetime.Scoped, null, serviceFactory); + this.RegisterService(typeof(TClass), Lifetime.Scoped, null, serviceFactory, registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterTransient(Type tClass) + public void RegisterTransient(Type tClass, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Transient); + this.RegisterService(tClass, Lifetime.Transient, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterTransient(Type tClass, Func serviceFactory) + public void RegisterTransient(Type tClass, Func serviceFactory, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Transient, null, serviceFactory); + this.RegisterService(tClass, Lifetime.Transient, null, serviceFactory, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterSingleton(Type tClass) + public void RegisterSingleton(Type tClass, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Singleton); + this.RegisterService(tClass, Lifetime.Singleton, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterSingleton(Type tClass, Func serviceFactory) + public void RegisterSingleton(Type tClass, Func serviceFactory, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Singleton, null, serviceFactory); + this.RegisterService(tClass, Lifetime.Singleton, null, serviceFactory, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Thrown when contains an entry for the provided interface type. - public void RegisterScoped(Type tClass) + public void RegisterScoped(Type tClass, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Scoped); + this.RegisterService(tClass, Lifetime.Scoped, registerAllInterfaces: registerAllInterfaces); } /// /// Register a service into with . /// Registers the service for all interfaces it implements. /// + /// If true, will register all interfaces implemented by the provided class./> /// Type of implementation. /// Factory for implementation. /// Thrown when the provided serviceFactory is null. /// Thrown when contains an entry for the provided interface type. - public void RegisterScoped(Type tClass, Func serviceFactory) + public void RegisterScoped(Type tClass, Func serviceFactory, bool registerAllInterfaces = false) { - this.RegisterService(tClass, Lifetime.Scoped, null, serviceFactory); + this.RegisterService(tClass, Lifetime.Scoped, null, serviceFactory, registerAllInterfaces: registerAllInterfaces); } /// /// Register the current service manager as a valid dependency. /// - /// Same functionality as calling with current . + /// Registers current service manager as , , , . public void RegisterServiceManager() { - this.RegisterService(typeof(ServiceManager), Lifetime.Singleton, null, new Func((sp) => { return this; })); + this.RegisterSingleton(sp => this); + this.RegisterSingleton(sp => this); + this.RegisterSingleton(sp => this); + this.RegisterSingleton(sp => this); } /// @@ -464,6 +483,14 @@ namespace Slim { this.Resolvers.Add(dependencyResolver); } + /// + /// Cleans up resources and disposes of all disposable singletons. + /// + public void Dispose() + { + this.Dispose(disposing: true); + GC.SuppressFinalize(this); + } private IEnumerable EnumerateAndReturnServicesOfType(Type type) { @@ -476,7 +503,7 @@ namespace Slim } } } - private void RegisterService(Type tClass, Lifetime lifetime, Type tInterface = null, Delegate serviceFactory = null) + private void RegisterService(Type tClass, Lifetime lifetime, Type tInterface = null, Delegate serviceFactory = null, bool registerAllInterfaces = false) { if (tInterface is not null) { @@ -489,12 +516,15 @@ namespace Slim return; } - foreach (var i in tClass.GetInterfaces()) + if (registerAllInterfaces) { - this.Map(i, tClass, lifetime); - if (serviceFactory is not null) + foreach (var i in tClass.GetInterfaces()) { - this.RegisterFactory(i, serviceFactory); + this.Map(i, tClass, lifetime); + if (serviceFactory is not null) + { + this.RegisterFactory(i, serviceFactory); + } } } @@ -733,5 +763,38 @@ namespace Slim throw exception; } } + private void Dispose(bool disposing) + { + if (!this.disposedValue) + { + if (disposing) + { + /* + * Dispose of all instances. If this instance of ServiceManager is scoped, ignore the Singleton instances as they are shared + * across multiple service managers. + */ + foreach (var interfacePair in this.InterfaceMapping + .Where(kvp => kvp.Value.Item2 != Lifetime.Transient) + .Where(kvp => this.scoped is false || kvp.Value.Item2 != Lifetime.Singleton)) + { + if (this.Instances.TryGetValue(interfacePair.Key, out var instance) && instance is IDisposable disposable) + { + disposable.Dispose(); + } + else if (this.Instances.TryGetValue(interfacePair.Value.Item1, out var instance2) && instance2 is IDisposable disposable2) + { + disposable2.Dispose(); + } + } + } + + this.InterfaceMapping.Clear(); + this.Instances.Clear(); + this.Resolvers.Clear(); + this.ExceptionHandlers.Clear(); + this.Factories.Clear(); + this.disposedValue = true; + } + } } } \ No newline at end of file diff --git a/Slim/Slim.csproj b/Slim/Slim.csproj index 41f0fe7..717cd15 100644 --- a/Slim/Slim.csproj +++ b/Slim/Slim.csproj @@ -8,10 +8,10 @@ Service lifetime management and dependency injection framework. - 1.5.2 - 1.5.2 + 1.5.3 + 1.5.3 https://github.com/AlexMacocian/Slim - 1.5.2 + 1.5.3 true true LICENSE diff --git a/Slim/Slim.xml b/Slim/Slim.xml index 4b7d02d..2b408b2 100644 --- a/Slim/Slim.xml +++ b/Slim/Slim.xml @@ -55,7 +55,7 @@ Register the current service manager as a valid dependency. - Same functionality as calling with current . + Registers current service manager as , , , . @@ -90,55 +90,61 @@ Interface allowing to produce services for the . - + + + Register a service into with . + Registers the service for all interfaces it implements. + + If true, will register all interfaces implemented by the provided class./> + Type of implementation. + Thrown when contains an entry for the provided interface type. + + Register a service into with . Registers the service for all interfaces it implements. Type of implementation. + If true, will register all interfaces implemented by the provided class./> + Factory for the implementation. + Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + - Register a service into with . + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> + Type of implementation. + Thrown when contains an entry for the provided interface type. + + + + Register a service into with . + Registers the service for all interfaces it implements. + + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for the implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - - - Register a service into with . - Registers the service for all interfaces it implements. - - Type of implementation. - Thrown when contains an entry for the provided interface type. - - - - Register a service into with . - Registers the service for all interfaces it implements. - - Type of implementation. - Factory for the implementation. - Thrown when the provided serviceFactory is null. - Thrown when contains an entry for the provided interface type. - - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for the implementation. Thrown when the provided serviceFactory is null. @@ -252,55 +258,61 @@ Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. @@ -463,109 +475,121 @@ Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for the implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for the implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for the implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Thrown when contains an entry for the provided interface type. - + Register a service into with . Registers the service for all interfaces it implements. + If true, will register all interfaces implemented by the provided class./> Type of implementation. Factory for implementation. Thrown when the provided serviceFactory is null. @@ -575,7 +599,7 @@ Register the current service manager as a valid dependency. - Same functionality as calling with current . + Registers current service manager as , , , . @@ -642,5 +666,10 @@ that manually creates a dependency. + + + Cleans up resources and disposes of all disposable singletons. + +