SES-67 #6

Merged
s426134 merged 3 commits from SES-67 into master 2020-12-03 22:35:21 +01:00
2 changed files with 111 additions and 80 deletions
Showing only changes of commit dfc3cdac98 - Show all commits

View File

@ -0,0 +1,28 @@
using Microsoft.Extensions.DependencyInjection;
using SessionCompanion.Database.Repositories;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SessionCompanion.Configurations
{
public static class RepositoryConfiguration
{
public static IServiceCollection AddRepositories(this IServiceCollection services)
{
services.AddScoped<IRepository<Alignment>, AlignmentRepository>();
services.AddScoped<IRepository<Background>, BackgroundRepository>();
services.AddScoped<IRepository<Biography>, BiographyRepository>();
services.AddScoped<IRepository<Character>, CharacterRepository>();
services.AddScoped<IRepository<Class>, ClassRepository>();
services.AddScoped<IRepository<Race>, RaceRepository>();
services.AddScoped<IRepository<Statistics>, StatisticsRepository>();
services.AddScoped<IRepository<User>, UserRepository>();
return services;
}
}
}

View File

@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SessionCompanion.Configurations;
using SessionCompanion.Database;
namespace SessionCompanion
@ -27,6 +28,8 @@ namespace SessionCompanion
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddRepositories();
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{