protected RepositoryBaseTest() { Connection = new SqliteConnection("DataSource=:memory:"); Connection.Open(); var options = new DbContextOptionsBuilder <CoastlineContext>() .UseSqlite(Connection) .Options; Context = new CoastlineContext(options); Context.Database.EnsureCreatedAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CoastlineContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(appBuilder => { appBuilder.Run(async httpContext => { httpContext.Response.StatusCode = 500; await httpContext.Response.WriteAsync("An unexpected fault has happend. Try again later"); }); }); } if (Configuration["DatabaseMigrations"] == "automatic") { context.Database.Migrate(); } app.UseRouting(); app.UseCors(builder => { builder.WithOrigins(Configuration["AllowedOrigin"]) .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); app.UseAuthentication(); app.UseAuthorization(); // Register the Swagger generator and the Swagger UI middlewares app.UseOpenApi(); app.UseSwaggerUi3(options => { options.Path = ""; }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public StudyGroupRepository(CoastlineContext context) : base(context) { }
protected RepositoryBase(CoastlineContext context) { Context = context ?? throw new ArgumentNullException(nameof(context)); }
public ModuleRepository(CoastlineContext context) : base(context) { }
public UserRepository(CoastlineContext context) : base(context) { }