forked from aly/qstbak
punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
25
Questionable/Questionable/ServiceCollectionExtensions.cs
Normal file
25
Questionable/Questionable/ServiceCollectionExtensions.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue