-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
61 lines (50 loc) · 1.67 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Fivet.Dao;
using Fivet.ZeroIce;
using Fivet.ZeroIce.model;
namespace Fivet.Server
{
class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host
.CreateDefaultBuilder(args)
.UseEnvironment("Development")
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole(options =>
{
options.IncludeScopes = true;
options.TimestampFormat = "[yyyy-MM-dd HH:mm:ss.fff]";
options.DisableColors = false;
});
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseConsoleLifetime()
.ConfigureServices((context, services) =>
{
//FiveContext
services.AddDbContext<FivetContext>();
// The FivetService
services.AddHostedService<FivetService>();
//TheSystem
services.AddSingleton<TheSystemDisp_,TheSystemImpl>();
//Contratos
services.AddSingleton<ContratosDisp_,ContratosImpl>();
services.AddLogging();
services.Configure<HostOptions>(option =>
{
option.ShutdownTimeout = System.TimeSpan.FromSeconds(15);
});
});
}
}
}