-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMauiProgram.cs
More file actions
52 lines (42 loc) · 1.67 KB
/
Copy pathMauiProgram.cs
File metadata and controls
52 lines (42 loc) · 1.67 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
using Microsoft.Extensions.Logging;
using EMS.Services;
using EMS.Models;
namespace EMS
{
/// <summary>
/// Registers several services to use within the application and initializes connection to the database
/// </summary>
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddTransient<DBService>(provider =>
{
string connectionString = "Server=107.180.27.178;Port=3306;Database=employeemanager;Uid=oopadmin;Pwd=taQoCt]ApQZ5;Connection Timeout=30";
return new DBService(connectionString);
});
builder.Services.AddMauiBlazorWebView();
builder.Services.AddSingleton<EmployeeService>();
builder.Services.AddSingleton<EmployeeMapper>();
builder.Services.AddSingleton<PayrollService>();
builder.Services.AddSingleton<PayrollMapper>();
builder.Services.AddSingleton<TimeRecordService>();
builder.Services.AddSingleton<TimeRecordMapper>();
builder.Services.AddSingleton<ReportService>();
builder.Services.AddSingleton<ReportMapper>();
builder.Services.AddSingleton<IOService>();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}
}