Skip to content

Commit 1f26d05

Browse files
committed
UseInMemoryDatabase
1 parent 0fa439f commit 1f26d05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

AspNetRunBasic/Startup.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ public Startup(IConfiguration configuration)
2121
// This method gets called by the runtime. Use this method to add services to the container.
2222
public void ConfigureServices(IServiceCollection services)
2323
{
24-
// add database dependecy
24+
//// use in-memory database
25+
//services.AddDbContext<AspnetRunContext>(c =>
26+
// c.UseInMemoryDatabase("AspnetRunConnection"));
27+
28+
// add real database dependecy
2529
services.AddDbContext<AspnetRunContext>(c =>
26-
c.UseSqlServer(Configuration.GetConnectionString("AspnetRunConnection")));
30+
c.UseSqlServer(Configuration.GetConnectionString("AspnetRunConnection")));
31+
2732
// add repository dependecy
2833
services.AddScoped<IProductRepository, ProductRepository>();
2934

0 commit comments

Comments
 (0)