2024-03-17 22:27:01 +01:00
|
|
|
using Avalonia.Controls.Templates;
|
|
|
|
|
|
|
|
|
|
using Dock.Model.Core;
|
|
|
|
|
|
2024-02-21 02:17:33 +01:00
|
|
|
using InkForge.Data;
|
2024-03-17 22:27:01 +01:00
|
|
|
using InkForge.Desktop;
|
2024-02-16 02:23:58 +01:00
|
|
|
using InkForge.Desktop.Data;
|
2024-02-21 02:17:33 +01:00
|
|
|
using InkForge.Desktop.Data.Options;
|
|
|
|
|
using InkForge.Desktop.Managers;
|
|
|
|
|
using InkForge.Desktop.Models;
|
2024-03-17 22:27:01 +01:00
|
|
|
using InkForge.Desktop.ViewModels.Workspaces;
|
|
|
|
|
using InkForge.Desktop.ViewModels.Workspaces.Internal;
|
2024-02-09 01:23:38 +01:00
|
|
|
|
2024-02-16 02:23:58 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
2024-02-09 01:23:38 +01:00
|
|
|
namespace Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
public static class InkForgeServiceCollections
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddInkForge(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddHttpClient();
|
|
|
|
|
|
2024-02-26 18:08:18 +01:00
|
|
|
// Singletons
|
|
|
|
|
// - Concrete
|
|
|
|
|
services.AddSingleton<DocumentManager>();
|
2024-03-17 22:27:01 +01:00
|
|
|
services.AddSingleton<InkForgeFactory>();
|
2024-02-26 18:08:18 +01:00
|
|
|
services.AddSingleton<WorkspaceManager>();
|
2024-03-17 22:27:01 +01:00
|
|
|
|
|
|
|
|
// - Service
|
|
|
|
|
services.AddSingleton<IDataTemplate, AppViewLocator>();
|
|
|
|
|
services.AddSingleton<IWorkspaceViewModelFactory, WorkspaceViewModelFactory>();
|
2024-02-16 02:23:58 +01:00
|
|
|
|
2024-02-26 18:08:18 +01:00
|
|
|
// Scoped
|
|
|
|
|
// - Concrete
|
2024-02-21 02:17:33 +01:00
|
|
|
services.AddScoped<LocalWorkspaceOptions>();
|
2024-02-09 01:23:38 +01:00
|
|
|
|
2024-02-26 18:08:18 +01:00
|
|
|
// - Service
|
|
|
|
|
services.AddScoped<IDbContextFactory<NoteDbContext>, NoteDbContextFactory>();
|
|
|
|
|
services.AddScoped<IWorkspaceContext, WorkspaceContext>();
|
|
|
|
|
|
|
|
|
|
// - Forwarders
|
|
|
|
|
services.AddScoped(s => s.GetRequiredService<IWorkspaceContext>().Workspace!);
|
2024-02-09 01:23:38 +01:00
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|