Change project to 3-Layer structure

This commit is contained in:
Tech Garage 2023-06-02 15:26:29 +03:30
parent 2f900a5036
commit 2d67540e13
1365 changed files with 760 additions and 618 deletions

View file

@ -0,0 +1,33 @@
using Microsoft.Extensions.DependencyInjection;
using MTWireGuard;
using MTWireGuard.Application.Mapper;
using MTWireGuard.Application.Repositories;
using MTWireGuard.Application.Services;
using System.Reflection;
namespace MTWireGuard.Application
{
public static class ApplicationServiceRegister
{
public static void AddApplicationServices(this IServiceCollection services)
{
// Add DBContext
services.AddDbContext<DBContext>(ServiceLifetime.Singleton);
// Auto Mapper Configurations
services.AddSingleton<PeerMapping>();
services.AddSingleton<ServerMapping>();
services.AddSingleton<MappingProfile>();
services.AddAutoMapper(
(provider, expression) => {
expression.AddProfile(provider.GetService<PeerMapping>());
expression.AddProfile(provider.GetService<ServerMapping>());
expression.AddProfile(provider.GetService<MappingProfile>());
},
new List<Assembly>());
// Add Mikrotik API Service
services.AddSingleton<IMikrotikRepository, MTAPI>();
}
}
}