-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (22 loc) · 1.01 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
27
28
29
30
31
32
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.EventLog;
using System.Reflection;
using Veronica.Sandbox.WS;
using Veronica.Sandbox.WS.Interfaces;
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services => {
LoggerProviderOptions.RegisterProviderOptions<EventLogSettings, EventLogLoggerProvider>(services);
//services.AddTransient<ITransientClass, TransientClass>();
//services.AddScoped<IScopedClass, ScopedClass>();
services.AddSingleton<ISingletonClass, SingletonClass>();
services.AddHostedService<Worker>();
//services.AddHostedService<WorkerTwo>();
services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(Assembly.GetExecutingAssembly()));
})
.ConfigureLogging((context, logging) => {
// See: https://github.com/dotnet/runtime/issues/47303
logging.AddConfiguration(
context.Configuration.GetSection("Logging"));
})
.Build();
await host.RunAsync();