Skip to content

Commit

Permalink
Fix StartupTask DI registration
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmskywalker committed Jul 13, 2021
1 parent cb0ed30 commit 5ae4609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/core/Elsa.Core/Runtime/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public static IServiceCollection AddStartupRunner(this IServiceCollection servic
public static IServiceCollection AddStartupTask<TStartupTask>(this IServiceCollection services) where TStartupTask : class, IStartupTask
{
return services
.AddScoped<IStartupTask, TStartupTask>()
.AddScoped<TStartupTask>();
.AddScoped<TStartupTask>()
.AddScoped<IStartupTask, TStartupTask>(sp => sp.GetRequiredService<TStartupTask>());
}

public static IServiceCollection AddStartupTask<TStartupTask>(this IServiceCollection services, Func<IServiceProvider, TStartupTask> factory) where TStartupTask : class, IStartupTask
{
return services
.AddScoped<IStartupTask, TStartupTask>(factory)
.AddScoped<TStartupTask>();
.AddScoped(factory)
.AddScoped<IStartupTask, TStartupTask>(sp => sp.GetRequiredService<TStartupTask>());
}
}
}
1 change: 0 additions & 1 deletion src/server/Elsa.Server.Api/Elsa.Server.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />

<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
Expand Down

0 comments on commit 5ae4609

Please sign in to comment.