-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
26 lines (22 loc) · 1.09 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using ConfigSample;
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
var environment = context.HostingEnvironment;
var configuration = context.Configuration;
// register IDistributedLockProvider
var path = configuration.GetValue<string?>("DistributedLocking:FilePath")
?? Path.Combine(environment.ContentRootPath, "distributed-locks");
services.AddSingleton<Medallion.Threading.IDistributedLockProvider>(provider =>
{
return new Medallion.Threading.FileSystem.FileDistributedSynchronizationProvider(Directory.CreateDirectory(path));
});
// register periodic tasks
services.AddPeriodicTasks(builder =>
{
builder.AddTask<CookingTask>();
builder.AddTask<WashingTask>();
});
})
.Build();
await host.RunAsync();