Files
graphql-test/Infrastructure/DependencyInjection.cs
2025-11-26 16:50:06 -03:00

23 lines
869 B
C#

using Application.Interfaces.Repositories;
using Infrastructure.Database;
using Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Infrastructure;
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
{
return services.AddDbContextFactory<AppDbContext>(options =>
options
.UseInMemoryDatabase("Skibibase")
.UseSeeding((c, _) => DbSeeder.Seed(c))
.UseAsyncSeeding((async (context, _, token) => await DbSeeder.SeedAsync(context, token)))
.EnableSensitiveDataLogging()
)
.AddScoped<IUserRepository, UserRepository>()
.AddScoped<IKillRepository, KillRepository>();
}
}