Last active
July 7, 2019 16:58
-
-
Save RedGhoul/37e276ee9e177a239c009cc2d20608ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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