pr1/presence/Presence.Desktop/DI/ServiceCollectionExtensions.cs
2024-12-23 12:12:26 +03:00

33 lines
1.0 KiB
C#

using data;
using data.Repository;
using domain.Service;
using domain.UseCase;
using Microsoft.Extensions.DependencyInjection;
using presence.data.RemoteData.RemoteDataBase;
using presence.data.Repository;
using presence.domain.UseCase;
using Presence.Desktop.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Presence.Desktop.DI
{
public static class ServiceColletionExtensions
{
public static void AddCommonService(this IServiceCollection collection)
{
collection
.AddDbContext<RemoteDatabaseContext>()
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<PresenceUseCase>()
.AddSingleton<UserUseCase>()
.AddTransient<GroupUseCase>();
}
}
}