-
-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathProgram.cs
30 lines (26 loc) · 874 Bytes
/
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
27
28
29
30
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Hosting
{
public class Program
{
public static void Main()
{
IHostBuilder hostBuilder = CreateHostBuilder();
IHost host = hostBuilder.Build();
// starts application and blocks the main calling thread
host.Run();
}
public static IHostBuilder CreateHostBuilder() =>
Host.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddSingleton(typeof(IHardwareService), typeof(HardwareService));
services.AddHostedService(typeof(LedService));
});
}
}