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.