Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
freever committed Jul 28, 2023
1 parent bf59cd1 commit c289e22
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>Blauhaus</Authors>
<LangVersion>latest</LangVersion>
<Product>Blauhaus.Ioc</Product>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blauhaus.Common.Abstractions" Version="2.2.12" />
<PackageReference Include="Blauhaus.Common.Abstractions" Version="2.3.18" />
</ItemGroup>

</Project>
11 changes: 11 additions & 0 deletions src/Blauhaus.Ioc.Abstractions/StartupTasks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Blauhaus.Ioc.Abstractions;

//collection of tasks that can be registered with a container to be run when the container is ready
public class StartupTasks : List<Func<Task>>
{
public StartupTasks(params Func<Task>[] tasks) : base(tasks) { }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Blauhaus.Ioc.Abstractions;
using System;
using System.Threading.Tasks;
using Blauhaus.Ioc.Abstractions;
using Microsoft.Extensions.DependencyInjection;

namespace Blauhaus.Ioc.DotNetCoreIocService
Expand All @@ -11,5 +13,10 @@ public static IServiceCollection AddServiceLocator(this IServiceCollection servi
services.AddScoped<IServiceLocator>(sp => new DotNetCoreServiceLocator(sp));
return services;
}
public static IServiceCollection AddStartupTask(this IServiceCollection services, Func<Task>[] tasks)
{
services.AddTransient(_ => new StartupTasks(tasks));
return services;
}
}
}

0 comments on commit c289e22

Please sign in to comment.