diff --git a/examples/ConductorSharp.Definitions/Program.cs b/examples/ConductorSharp.Definitions/Program.cs index 5fa8be0e..e716921c 100644 --- a/examples/ConductorSharp.Definitions/Program.cs +++ b/examples/ConductorSharp.Definitions/Program.cs @@ -51,7 +51,7 @@ pipelines.AddRequestResponseLogging(); pipelines.AddValidation(); }) - .AddCSharpLambdaTasks(typeof(ITaskRequestHandler<,>).Assembly.GetName().Name); + .AddCSharpLambdaTasks(); builder.RegisterModule(); } diff --git a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs index d3cb7b63..0f6a98ba 100644 --- a/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/CSharpLambdaTaskBuilder.cs @@ -25,12 +25,15 @@ Func lambda where TWorkflow : ITypedWorkflow where TInput : IRequest { - var lambdaTaskNamePrefix = (string) - builder.ConfigurationProperties.FirstOrDefault(prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty).Value; + var prefixConfigProperty = builder.ConfigurationProperties.FirstOrDefault( + prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty + ); - if (lambdaTaskNamePrefix == null) + if (prefixConfigProperty == null) throw new LambdaTasksNotEnabledException(); + var lambdaTaskNamePrefix = TaskNameBuilder.MakeTaskNamePrefix(prefixConfigProperty.Value as string); + var taskBuilder = new CSharpLambdaTaskBuilder( task.Body, input.Body, @@ -73,7 +76,7 @@ public override WorkflowDefinition.Task[] Build() { new WorkflowDefinition.Task { - Name = $"{_lambdaTaskNamePrefix}.{CSharpLambdaTask.TaskName}", + Name = $"{_lambdaTaskNamePrefix}{CSharpLambdaTask.TaskName}", TaskReferenceName = _taskRefferenceName, InputParameters = new JObject { diff --git a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs index f49707d2..34788803 100644 --- a/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs +++ b/src/ConductorSharp.Patterns/Builders/TaskNameBuilder.cs @@ -22,7 +22,9 @@ public override string Build(Type taskType) => private string GetLambdaTaskPrefix() { var prefix = (string)_configurationProperties.First(prop => prop.Key == CSharpLambdaTask.LambdaTaskNameConfigurationProperty).Value; - return prefix == null ? string.Empty : $"{prefix}."; + return MakeTaskNamePrefix(prefix); } + + public static string MakeTaskNamePrefix(string prefix) => prefix == null ? string.Empty : $"{prefix}."; } }