using CommunityToolkit.Mvvm.Messaging; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.EntityFrameworkCore; using SteUp.Data.LocalDb; using SteUp.Data.LocalDb.EntityServices; using SteUp.Maui.Core.Services; using SteUp.Maui.Core.System; using SteUp.Maui.Core.System.Network; using SteUp.Shared.Core.BarcodeReader; using SteUp.Shared.Core.BarcodeReader.Contracts; using SteUp.Shared.Core.Data; using SteUp.Shared.Core.Data.Contracts; using SteUp.Shared.Core.Interface; using SteUp.Shared.Core.Interface.IntegryApi; using SteUp.Shared.Core.Interface.LocalDb; using SteUp.Shared.Core.Interface.System; using SteUp.Shared.Core.Interface.System.Network; using SteUp.Shared.Core.Messages.Ispezione; using SteUp.Shared.Core.Messages.Scanner; using SteUp.Shared.Core.Messages.Scheda; using SteUp.Shared.Core.Services; namespace SteUp.Maui.Core; public static class CoreModule { extension(MauiAppBuilder builder) { public void RegisterAppServices() { builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddSingleton(); } public void RegisterIntegryServices() { builder.Services.AddScoped(); builder.Services.AddScoped(); } public void RegisterSystemService() { builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); } public void AddAuthorizationCore() { builder.Services.AddAuthorizationCore(); builder.Services.AddScoped(); builder.Services.AddScoped(provider => provider.GetRequiredService()); } public void RegisterMessageServices() { builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); } public void RegisterDbServices() { builder.Services.AddSingleton(); builder.Services.AddDbContext((sp, options) => { var dbPath = sp.GetRequiredService().GetDbPath(); options.UseSqlite($"Filename={dbPath}"); }); builder.Services.AddSingleton(); builder.Services.AddSingleton(); } } }