diff --git a/src/ConductorSharp.Engine/Extensions/TaskRegistrationExtensions.cs b/src/ConductorSharp.Engine/Extensions/TaskRegistrationExtensions.cs index 139da112..dcfa43bb 100644 --- a/src/ConductorSharp.Engine/Extensions/TaskRegistrationExtensions.cs +++ b/src/ConductorSharp.Engine/Extensions/TaskRegistrationExtensions.cs @@ -1,42 +1,27 @@ +using System; using ConductorSharp.Engine.Builders; using ConductorSharp.Engine.Interface; using ConductorSharp.Engine.Model; using ConductorSharp.Engine.Util.Builders; using Microsoft.Extensions.DependencyInjection; -using System; namespace ConductorSharp.Engine.Extensions { public static class TaskRegistrationExtensions { - public static void RegisterWorkerTask( - this IServiceCollection builder, - Action updateOptions = null, - BuildConfiguration buildConfiguration = null - ) where TWorkerTask : IWorker + public static void RegisterWorkerTask(this IServiceCollection builder, Action updateOptions = null) + where TWorkerTask : IWorker { - builder.AddSingleton(ctx => ctx.ResolveTaskDefinitionBuilder(buildConfiguration).Build(updateOptions)); + builder.AddSingleton(ctx => ctx.GetRequiredService().Build(updateOptions)); builder.AddTransient( ctx => new TaskToWorker { - TaskName = ctx.ResolveTaskDefinitionBuilder(buildConfiguration).Build(updateOptions).Name, + TaskName = ctx.GetRequiredService().Build(updateOptions).Name, TaskType = typeof(TWorkerTask) } ); } - - private static TaskDefinitionBuilder ResolveTaskDefinitionBuilder( - this IServiceProvider componentContext, - BuildConfiguration buildConfiguration - ) - { - var builder = componentContext.GetRequiredService(); - - builder.BuildConfiguration = buildConfiguration ?? builder.BuildConfiguration; - - return builder; - } } }