diff --git a/src/core/Elsa.Core/Elsa.Core.csproj.DotSettings b/src/core/Elsa.Core/Elsa.Core.csproj.DotSettings index af314d94e..9d2dd8dfd 100644 --- a/src/core/Elsa.Core/Elsa.Core.csproj.DotSettings +++ b/src/core/Elsa.Core/Elsa.Core.csproj.DotSettings @@ -1,4 +1,5 @@  True + True True True \ No newline at end of file diff --git a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs index f420f156e..97932b10f 100644 --- a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs +++ b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs @@ -59,22 +59,17 @@ namespace Microsoft.Extensions.DependencyInjection .AddTransient() .AddTransient(sp => sp.GetRequiredService()); - public static IServiceCollection AddWorkflow(this IServiceCollection services) where T : class, IWorkflow - { - services.TryAddSingleton(); - services.TryAddSingleton(sp => sp.GetRequiredService()); - return services; - } + public static IServiceCollection AddWorkflow(this IServiceCollection services) where T : class, IWorkflow => + services + .AddSingleton() + .AddSingleton(sp => sp.GetRequiredService()); public static IServiceCollection AddWorkflow(this IServiceCollection services, IWorkflow workflow) => services .AddSingleton(workflow.GetType(), workflow) .AddTransient(sp => workflow); - public static IServiceCollection StartWorkflow(this IServiceCollection services) where T : class, IWorkflow => - services - .AddWorkflow() - .AddHostedService>(); + public static IServiceCollection StartWorkflow(this IServiceCollection services) where T : class, IWorkflow => services.AddHostedService>(); private static IServiceCollection AddMediatR(this ElsaOptions options) => options.Services.AddMediatR(mediatr => mediatr.AsScoped(), typeof(IActivity)); @@ -98,7 +93,7 @@ namespace Microsoft.Extensions.DependencyInjection .AddSingleton() .AddSingleton() .AddScoped() - .AddScoped() + .AddScoped() .AddSingleton() .AddSingleton() .AddSingleton() @@ -155,10 +150,11 @@ namespace Microsoft.Extensions.DependencyInjection .AddActivity() .AddActivity() .AddActivity() - .AddTriggerProvider() .AddActivity() - .AddScoped() .AddActivity() + .AddActivity() + .AddScoped() + .AddTriggerProvider() .AddTriggerProvider(); } } \ No newline at end of file