This repository was archived by the owner on Feb 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (37 loc) · 1.24 KB
/
Program.cs
File metadata and controls
46 lines (37 loc) · 1.24 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using App.WindowsService.Application.Configuration;
using JGP.Telegram.Data;
namespace App.WindowsService;
/// <summary>
/// Class program
/// </summary>
public static class Program
{
/// <summary>
/// Main
/// </summary>
/// <returns>System.Threading.Tasks.Task</returns>
public static async Task Main()
{
var host = Host.CreateDefaultBuilder()
.ConfigureServices(ConfigureServices)
.Build();
using var scope = host.Services.CreateScope();
scope.ServiceProvider.EnsureMigrationOfContext<ChatContext>();
await host.RunAsync();
}
/// <summary>
/// Configures the services using the specified services
/// </summary>
/// <param name="services">The services</param>
private static void ConfigureServices(IServiceCollection services)
{
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", true, true)
.AddEnvironmentVariables()
.Build();
var appSettings = AppSettingsConfiguration.Configure(configuration);
services.AddSingleton(appSettings);
services.AddSingleton(configuration);
IocConfiguration.Configure(configuration, services);
}
}