From 2fcc9861016f0faf3ad93c8a5790a6ad6ceaef62 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 22 Nov 2021 20:06:42 +0100 Subject: [PATCH] Update ActivityType with sensible default value for ActivateAsync --- .../Elsa.Abstractions/Services/Models/ActivityType.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/Elsa.Abstractions/Services/Models/ActivityType.cs b/src/core/Elsa.Abstractions/Services/Models/ActivityType.cs index c69726c62..aea9790c8 100644 --- a/src/core/Elsa.Abstractions/Services/Models/ActivityType.cs +++ b/src/core/Elsa.Abstractions/Services/Models/ActivityType.cs @@ -3,11 +3,17 @@ using System.Collections.Generic; using System.Threading.Tasks; using Elsa.ActivityResults; using Elsa.Metadata; +using Microsoft.Extensions.DependencyInjection; namespace Elsa.Services.Models { public class ActivityType { + public ActivityType() + { + ActivateAsync = context => new ValueTask((IActivity)context.ServiceProvider.GetRequiredService(Type)); + } + /// /// The type name of this activity. /// @@ -33,7 +39,7 @@ namespace Elsa.Services.Models /// public IDictionary Annotations { get; set; } = new Dictionary(); - public Func> ActivateAsync { get; set; } = _ => new ValueTask(); + public Func> ActivateAsync { get; set; } /// /// Returns a value of whether the specified activity can execute.