Added mongo db repository

This commit is contained in:
2019-04-22 17:57:23 +00:00
parent 0f9a598fae
commit 83385a66c7
7 changed files with 74 additions and 8 deletions

View File

@@ -13,9 +13,9 @@ namespace BrightGlimmer.Api.Controllers
public class StudentController : ControllerBase
{
// private readonly IMediator mediator;
private readonly StudentRepository studentRepository;
private readonly SqliteStudentRepository studentRepository;
public StudentController(StudentRepository studentRepository)
public StudentController(SqliteStudentRepository studentRepository)
{
this.studentRepository = studentRepository;
}

View File

@@ -32,7 +32,8 @@ namespace BrightGlimmer.Api
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddMediatR();
services.AddMediatR(typeof(Cqrs.Cqrs).Assembly); // Registers handlers in Cqrs project
services.AddScoped<StudentRepository, StudentRepository>(); /* REMOVE LATER */
services.AddScoped<SqliteStudentRepository, SqliteStudentRepository>(); /* REMOVE LATER */
services.AddScoped<MongoStudentRepository, MongoStudentRepository>(); /* REMOVE LATER */
services.AddDbContext<SqliteDatabaseContext>(options => options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
services.AddTransient<SqliteDatabaseContext>();
}