2023-05-17 16:30:13 +10:00
|
|
|
|
using PARR.API.Services.Implementations;
|
|
|
|
|
|
using PARR.API.Services.Interfaces;
|
2023-05-17 16:00:50 +10:00
|
|
|
|
|
2023-05-17 16:30:13 +10:00
|
|
|
|
namespace PARR.API.Installers
|
2023-05-17 16:00:50 +10:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Самописные сервисы которые используются для АПИ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class ApiServicesInstaller
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void InstallApiServices(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
|
{
|
|
|
|
|
|
services.AddSingleton<IUriService>(provider =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var accessor = provider.GetRequiredService<IHttpContextAccessor>();
|
|
|
|
|
|
var request = accessor.HttpContext.Request;
|
|
|
|
|
|
var absoluteUri = string.Concat(request.Scheme, "://", request.Host.ToUriComponent(), "/");
|
|
|
|
|
|
|
|
|
|
|
|
return new UriService(absoluteUri);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2023-06-16 15:00:11 +10:00
|
|
|
|
services.AddTransient<IClientService, ClientService>();
|
2023-08-25 10:25:24 +10:00
|
|
|
|
|
2023-05-17 16:00:50 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|