1
0
Fork 0
forked from aly/qstbak

punish v6.8.18.0

This commit is contained in:
alydev 2025-10-09 07:47:19 +10:00
commit cfb4dea47e
316 changed files with 554088 additions and 0 deletions

View file

@ -0,0 +1,25 @@
using Microsoft.Extensions.DependencyInjection;
using Questionable.Controller.Steps;
namespace Questionable;
internal static class ServiceCollectionExtensions
{
public static void AddTaskFactory<TFactory>(this IServiceCollection serviceCollection) where TFactory : class, ITaskFactory
{
serviceCollection.AddSingleton<ITaskFactory, TFactory>();
serviceCollection.AddSingleton<TFactory>();
}
public static void AddTaskExecutor<T, TExecutor>(this IServiceCollection serviceCollection) where T : class, ITask where TExecutor : TaskExecutor<T>
{
serviceCollection.AddKeyedTransient<ITaskExecutor, TExecutor>(typeof(T));
serviceCollection.AddTransient<TExecutor>();
}
public static void AddTaskFactoryAndExecutor<T, TFactory, TExecutor>(this IServiceCollection serviceCollection) where T : class, ITask where TFactory : class, ITaskFactory where TExecutor : TaskExecutor<T>
{
serviceCollection.AddTaskFactory<TFactory>();
serviceCollection.AddTaskExecutor<T, TExecutor>();
}
}