-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceRegistration.cs
More file actions
48 lines (47 loc) · 1.92 KB
/
ServiceRegistration.cs
File metadata and controls
48 lines (47 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using ECommerceAPI.Application.Abstractions.Services;
using ECommerceAPI.Application.Abstractions.Services.Configurations;
using ECommerceAPI.Application.Abstractions.Storage;
using ECommerceAPI.Application.Abstractions.Token;
using ECommerceAPI.Infrastructure.Enums;
using ECommerceAPI.Infrastructure.Services;
using ECommerceAPI.Infrastructure.Services.Configuration;
using ECommerceAPI.Infrastructure.Services.Storage;
using ECommerceAPI.Infrastructure.Services.Storage.Azure;
using ECommerceAPI.Infrastructure.Services.Storage.Local;
using ECommerceAPI.Infrastructure.Services.Token;
using Microsoft.Extensions.DependencyInjection;
namespace ECommerceAPI.Infrastructure
{
public static class ServiceRegistration
{
public static void AddInfrastructureServices(this IServiceCollection services)
{
services.AddScoped<IStorageService, StorageService>();
services.AddScoped<ITokenHandler, TokenHandler>();
services.AddScoped<IMailService, MailService>();
services.AddScoped<IApplicationService, ApplicationService>();
services.AddScoped<IQRCodeService, QRCodeService>();
}
public static void AddStorage<T>(this IServiceCollection services) where T : Storage, IStorage
{
services.AddScoped<IStorage, T>();
}
public static void AddStorage(this IServiceCollection services, StorageType storageType)
{
switch (storageType)
{
case StorageType.Local:
services.AddScoped<IStorage, LocalStorage>();
break;
case StorageType.Azure:
services.AddScoped<IStorage, AzureStorage>();
break;
case StorageType.AWS:
//services.AddScoped<IStorage, T>();
break;
default:
break;
}
}
}
}