From a69afa2264e4cf2a8c8f1a27b42e6f7d9ef9b0d6 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Fri, 21 Apr 2017 00:06:40 -0400 Subject: [PATCH] Switching to InMemory for Mac --- src/Web/Infrastructure/CatalogContextSeed.cs | 3 ++- src/Web/Startup.cs | 6 ++++-- src/Web/Web.csproj | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Web/Infrastructure/CatalogContextSeed.cs b/src/Web/Infrastructure/CatalogContextSeed.cs index 8646243..38d74cd 100644 --- a/src/Web/Infrastructure/CatalogContextSeed.cs +++ b/src/Web/Infrastructure/CatalogContextSeed.cs @@ -19,7 +19,8 @@ var context = (CatalogContext)applicationBuilder .ApplicationServices.GetService(typeof(CatalogContext)); - context.Database.Migrate(); + // TODO: Only run this if using a real database + // context.Database.Migrate(); if (!context.CatalogBrands.Any()) { diff --git a/src/Web/Startup.cs b/src/Web/Startup.cs index 24d7dd2..35ad1d7 100644 --- a/src/Web/Startup.cs +++ b/src/Web/Startup.cs @@ -35,7 +35,8 @@ namespace Microsoft.eShopWeb { try { - c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")); + c.UseInMemoryDatabase("Catalog"); + //c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")); c.ConfigureWarnings(wb => { //By default, in this application, we don't want to have client evaluations @@ -50,7 +51,8 @@ namespace Microsoft.eShopWeb // Add Identity DbContext services.AddDbContext(options => - options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection"))); + options.UseInMemoryDatabase("Identity")); +// options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection"))); services.AddIdentity() .AddEntityFrameworkStores() diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index 22a20b3..7714b09 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -18,6 +18,7 @@ +