Program.cs 482 B

123456789101112131415161718
  1. IHost host = Host.CreateDefaultBuilder(args)
  2. .UseWindowsService()
  3. .ConfigureLogging(loggerfactory => loggerfactory.AddEventLog())
  4. .ConfigureServices((hostContext, services) => {
  5. IConfiguration configuration = hostContext.Configuration;
  6. services.AddHostedService<Worker>();
  7. services.ConfigurePgSqlContext(configuration);
  8. services.AddSingleton<UpdateOperations>();
  9. services.AddScoped<IRepositoryWrapper, RepositoryWrapper>();
  10. })
  11. .Build();
  12. await host.RunAsync();