2024-11-14 15:17:43 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Persistence.Repositories;
|
|
|
|
|
using Persistence.Database.Model;
|
|
|
|
|
using Persistence.Repository.Data;
|
|
|
|
|
using Persistence.Repository.Repositories;
|
2024-11-15 11:50:49 +05:00
|
|
|
|
using Persistence.Models;
|
2024-11-14 15:17:43 +05:00
|
|
|
|
|
|
|
|
|
namespace Persistence.Repository;
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
|
|
|
|
public static void MapsterSetup()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
MapsterSetup();
|
|
|
|
|
|
|
|
|
|
string connectionStringName = "DefaultConnection";
|
|
|
|
|
|
|
|
|
|
services.AddDbContext<PersistenceDbContext>(options =>
|
|
|
|
|
options.UseNpgsql(configuration.GetConnectionString(connectionStringName)));
|
|
|
|
|
|
|
|
|
|
services.AddScoped<IPersistenceDbContext>(provider => provider.GetRequiredService<PersistenceDbContext>());
|
|
|
|
|
|
|
|
|
|
services.AddTransient<ITimeSeriesDataRepository<DataSaubDto>, TimeSeriesDataRepository<DataSaub, DataSaubDto>>();
|
2024-11-15 11:50:49 +05:00
|
|
|
|
services.AddTransient<IChangeLogRepository<LogDto, ChangeLogDto<LogDto>>, ChangeLogRepository<ChangeLog, LogDto, ChangeLogDto<LogDto>>>();
|
2024-11-14 15:17:43 +05:00
|
|
|
|
|
2024-11-15 11:50:49 +05:00
|
|
|
|
return services;
|
2024-11-14 15:17:43 +05:00
|
|
|
|
}
|
|
|
|
|
}
|