initial commit
This commit is contained in:
23
Infrastructure/DependencyInjection.cs
Normal file
23
Infrastructure/DependencyInjection.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user