SES-67 Add config to repositories
This commit is contained in:
parent
e3bcf28f46
commit
dfc3cdac98
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using SessionCompanion.Configurations;
|
||||||
using SessionCompanion.Database;
|
using SessionCompanion.Database;
|
||||||
|
|
||||||
namespace SessionCompanion
|
namespace SessionCompanion
|
||||||
@ -27,6 +28,8 @@ namespace SessionCompanion
|
|||||||
services.AddDbContext<ApplicationDbContext>(options =>
|
services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
options.UseSqlServer(
|
options.UseSqlServer(
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
|
services.AddRepositories();
|
||||||
|
|
||||||
// In production, the Angular files will be served from this directory
|
// In production, the Angular files will be served from this directory
|
||||||
services.AddSpaStaticFiles(configuration =>
|
services.AddSpaStaticFiles(configuration =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user