Вынес подключения в отдельный класс

parent 0f55c8e6
using Microsoft.EntityFrameworkCore;
using Payment.WebApi.Infrastructures.Databases;
using Payment.WebApi.Repositories;
using Payment.WebApi.Repositories.Interfaces;
namespace Payment.WebApi.Extensions;
public static class AppServicesExtension
{
public static void AddAppServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<PaymentDbContext>(opt
=> opt.UseNpgsql(configuration.GetConnectionString("ConnectionString")));
services.AddScoped<IUserRepository, UserRepository>();
services.AddScoped<ISupplierRepository, SupplierRepository>();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment