Skip to content

Instantly share code, notes, and snippets.

@RedGhoul
Last active July 7, 2019 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedGhoul/37e276ee9e177a239c009cc2d20608ba to your computer and use it in GitHub Desktop.
Save RedGhoul/37e276ee9e177a239c009cc2d20608ba to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
if (CurrentEnvironment.IsDevelopment()) // Here is where we check
{
services.AddDbContext<AppDbContext>(
options => options.UseInMemoryDatabase()); // And we ask it to use the InMemoryDatabase Option
}
else
{
services.AddDbContext<AppDbContext>(
options => options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
}
services.AddScoped<ICreditCardApplicationRepository,
EntityFrameworkCreditCardApplicationRepository>();
services.AddMvc();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment