presence/Presence.Desktop/DI/ServiceCollectionExtensions.cs
2024-12-16 07:10:04 +03:00

24 lines
873 B
C#

using data.RemoteData.RemoteDataBase;
using data.Repository;
using domain.UseCase;
using Microsoft.Extensions.DependencyInjection;
using Presence.Desktop.ViewModels;
namespace Presence.Desktop.DI
{
public static class ServiceCollectionExtensions
{
public static void AddCommonService(this IServiceCollection collection)
{
collection
.AddDbContext<RemoteDatabaseContext>()
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<UseCaseGeneratePresence>()
.AddSingleton<UserUseCase>()
.AddTransient<GroupUseCase>()
.AddTransient<MainWindowViewModel>();
}
}
}