From cb8846a7a3310f8513989da5aadb5202f048a1b3 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 14 Aug 2023 19:46:11 +0200 Subject: Code cleanup --- LibMatrix/Services/ServiceInstaller.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'LibMatrix/Services/ServiceInstaller.cs') diff --git a/LibMatrix/Services/ServiceInstaller.cs b/LibMatrix/Services/ServiceInstaller.cs index 96a1963..b1c98e1 100644 --- a/LibMatrix/Services/ServiceInstaller.cs +++ b/LibMatrix/Services/ServiceInstaller.cs @@ -9,14 +9,18 @@ public static class ServiceInstaller { if (!services.Any(x => x.ServiceType == typeof(TieredStorageService))) throw new Exception("[MRUCore/DI] No TieredStorageService has been registered!"); //Add config - if(config is not null) - services.AddSingleton(config); - else { - services.AddSingleton(new RoryLibMatrixConfiguration()); - } + services.AddSingleton(config ?? new RoryLibMatrixConfiguration()); + //Add services - services.AddSingleton(); services.AddSingleton(); + + if (services.First(x => x.ServiceType == typeof(TieredStorageService)).Lifetime == ServiceLifetime.Singleton) { + services.AddSingleton(); + } + else { + services.AddScoped(); + } + // services.AddScoped(); return services; } -- cgit 1.5.1