Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
60 lines (44 loc) · 1.73 KB
/
Copy pathProgram.cs
File metadata and controls
60 lines (44 loc) · 1.73 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using LogAudit.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using System.IO;
using Microsoft.Extensions.Logging;
namespace LogAudit
{
internal class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Configure necesary services
var builder = new HostBuilder()
.ConfigureServices((hostContext, services) =>
{
//Add the necesary connector for your database engine
services.AddDbContext<KiwiSyslogContext>(options =>
{
options.UseSqlServer("");
});
});
var host = builder.Build();
//Determines the working environment as IHostingEnvironment is unavailable in a console app
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
using (var serviceScope = host.Services.CreateScope())
{
var services = serviceScope.ServiceProvider;
var logg = services.GetRequiredService<ILogger<Form1>>();
//Create a Database Context and passing to the main form
var kiwiSyslogContext = services.GetRequiredService<KiwiSyslogContext>();
Application.Run(new Form1(kiwiSyslogContext));
}
}
}
}