mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-30 14:49:31 +02:00
Change project to 3-Layer structure
This commit is contained in:
parent
2f900a5036
commit
2d67540e13
1365 changed files with 760 additions and 618 deletions
33
Application/ApplicationServiceRegister.cs
Normal file
33
Application/ApplicationServiceRegister.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue