|
| 1 | +using System; |
| 2 | + |
| 3 | +// ReSharper disable once CheckNamespace |
| 4 | + |
| 5 | +namespace GameLovers.Services |
| 6 | +{ |
| 7 | + /// <inheritdoc cref="IInstaller"/> |
| 8 | + /// <remarks> |
| 9 | + /// Use this installer for generic Binding interfaces that are available in the entire scope of the game |
| 10 | + /// </remarks> |
| 11 | + public static class MainInstaller |
| 12 | + { |
| 13 | + private static readonly IInstaller _installer = new Installer(); |
| 14 | + |
| 15 | + /// <inheritdoc cref="IInstaller.Bind{T}"/> |
| 16 | + public static void Bind<T>(T instance) where T : class |
| 17 | + { |
| 18 | + _installer.Bind(instance); |
| 19 | + } |
| 20 | + |
| 21 | + /// <inheritdoc cref="IInstaller.TryResolve{T}"/> |
| 22 | + public static bool TryResolve<T>(out T instance) |
| 23 | + { |
| 24 | + return _installer.TryResolve(out instance); |
| 25 | + } |
| 26 | + |
| 27 | + /// <inheritdoc cref="IInstaller.Resolve{T}"/> |
| 28 | + public static T Resolve<T>() |
| 29 | + { |
| 30 | + return _installer.Resolve<T>(); |
| 31 | + } |
| 32 | + |
| 33 | + /// <inheritdoc cref="IInstaller.Clean"/> |
| 34 | + public static bool Clean<T>() where T : class |
| 35 | + { |
| 36 | + return _installer.Clean<T>(); |
| 37 | + } |
| 38 | + |
| 39 | + /// <inheritdoc cref="IInstaller.Clean"/> |
| 40 | + public static bool CleanDispose<T>() where T : class, IDisposable |
| 41 | + { |
| 42 | + _installer.Resolve<T>().Dispose(); |
| 43 | + |
| 44 | + return _installer.Clean<T>(); |
| 45 | + } |
| 46 | + |
| 47 | + /// <inheritdoc cref="IInstaller.Clean"/> |
| 48 | + public static void Clean() |
| 49 | + { |
| 50 | + _installer.Clean(); |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments