DI completely reworked to keep status of singletons on multi type components

This commit is contained in:
Alex
2025-05-06 10:52:22 +01:00
parent ba59afa354
commit 1499627d3c
300 changed files with 639 additions and 605 deletions
@@ -1,4 +1,4 @@
using SPTarkov.Common.Annotations;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -11,11 +11,10 @@ public class HideoutCraftQuestIdGeneratorLauncher
try
{
var serviceCollection = new ServiceCollection();
DependencyInjectionRegistrator.RegisterSptComponents(
typeof(HideoutCraftQuestIdGeneratorLauncher).Assembly,
typeof(App).Assembly,
serviceCollection
);
var diHandler = new DependencyInjectionHandler(serviceCollection);
diHandler.AddInjectableTypesFromTypeAssembly(typeof(HideoutCraftQuestIdGeneratorLauncher));
diHandler.AddInjectableTypesFromTypeAssembly(typeof(App));
diHandler.InjectAll();
var serviceProvider = serviceCollection.BuildServiceProvider();
serviceProvider.GetService<HideoutCraftQuestIdGenerator>().Run().Wait();
}
@@ -1,4 +1,4 @@
using SPTarkov.Common.Annotations;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Logging;
using SPTarkov.Server.Core.Models.Spt.Logging;
using SPTarkov.Server.Core.Models.Utils;
+1 -1
View File
@@ -1,5 +1,5 @@
using SPTarkov.Common.Annotations;
using SPTarkov.Common.Extensions;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Callbacks;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Helpers;
@@ -11,11 +11,10 @@ public class ItemTplGeneratorLauncher
try
{
var serviceCollection = new ServiceCollection();
DependencyInjectionRegistrator.RegisterSptComponents(
typeof(ItemTplGeneratorLauncher).Assembly,
typeof(App).Assembly,
serviceCollection
);
var diHandler = new DependencyInjectionHandler(serviceCollection);
diHandler.AddInjectableTypesFromTypeAssembly(typeof(ItemTplGeneratorLauncher));
diHandler.AddInjectableTypesFromTypeAssembly(typeof(App));
diHandler.InjectAll();
var serviceProvider = serviceCollection.BuildServiceProvider();
serviceProvider.GetService<ItemTplGenerator>().Run().Wait();
}
+1 -1
View File
@@ -1,4 +1,4 @@
using SPTarkov.Common.Annotations;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Logging;
using SPTarkov.Server.Core.Models.Spt.Logging;
using SPTarkov.Server.Core.Models.Utils;