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