Using dependency injection and viewmodel etc

This commit is contained in:
2025-08-20 12:08:46 +02:00
parent 2f053dfc71
commit 1649eaa992
17 changed files with 1143 additions and 31 deletions

View File

@ -1,4 +1,9 @@
using Microsoft.Extensions.Logging;
using AdventureWorks.DataLayer;
using AdventureWorks.EntityLayer;
using AdventureWorks.MAUI.Views;
using AdventureWorks.ViewModelLayer;
using Common.Library;
using Microsoft.Extensions.Logging;
//#if Windows
using Microsoft.Maui.LifecycleEvents;
@ -18,7 +23,12 @@ namespace AdventureWorks.MAUI
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
//DI Services
builder.Services.AddScoped<IRepository<User>, UserRepository>();
builder.Services.AddScoped<IRepository<EntityLayer.Color>, ColorRepository>();
builder.Services.AddScoped<IRepository<PhoneType>, PhoneTypeRepository>();
builder.Services.AddScoped<UserViewModel>();
builder.Services.AddScoped<UserDetailView>();
#if WINDOWS
SetWindowOptions(builder);
SetWindowHandlers();