-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (45 loc) · 1.71 KB
/
Copy pathProgram.cs
File metadata and controls
53 lines (45 loc) · 1.71 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Extensions.DependencyInjection;
using AviationMaintenanceManagementSystem.Features;
using AviationMaintenanceManagementSystem.Data_CRUDops_;
using AviationMaintenanceManagementSystem.ModelClasses;
using Microsoft.EntityFrameworkCore;
namespace AviationMaintenanceManagementSystem
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Dependency Injection
var features = new ServiceCollection();
ConfigureServices(features);
var serviceProvider = features.BuildServiceProvider();
Application.Run(serviceProvider.GetRequiredService<MaintenanceDashboard>());
}
private static void ConfigureServices(IServiceCollection features)
{
//Db Connection
features.AddDbContext<MaintenanceContext>(options =>
{
options.UseSqlite("Data Source = Maintenance.db");
});
//Features connection
features.AddTransient<IWorkOrderFeature, WorkOrderFeature>();
features.AddTransient<IWorkCenterFeature, WorkCenterFeature>();
features.AddTransient<IInventoryFeature, InventoryFeature>();
features.AddTransient<ICustomerFeature, CustomerFeature>();
//Forms connection
features.AddScoped<MaintenanceDashboard>();
}
}
}