Skip to content

Commit

Permalink
Automatically bind IDisposable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai Selivanov committed Jun 1, 2024
1 parent 30dab87 commit f825a35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/UnityMVVM/DI/DiContainerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ public static void FastBind<TImpl>(this DiContainer container, IReadOnlyCollecti
{
bindTypes.Add(typeof(IInitializable));
}
if (typeof(TImpl).Interfaces().Contains(typeof(IDisposable)))
{
bindTypes.Add(typeof(IDisposable));
}
container.Bind(bindTypes)
.To<TImpl>().AsSingle();

Expand Down

0 comments on commit f825a35

Please sign in to comment.