From 63c69b17e9af0eb34f92dddb98dd518edbb6fa03 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Wed, 3 Apr 2024 14:57:45 +0200 Subject: [PATCH] Remove unnecessary argument --- .../Extensions/TaskRegistrationExtensions.cs | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) 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; - } } }