Skip to content

Commit

Permalink
Switching to InMemory for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalis committed Apr 21, 2017
1 parent 222319f commit a69afa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Web/Infrastructure/CatalogContextSeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILogg
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())
{
Expand Down
6 changes: 4 additions & 2 deletions src/Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void ConfigureServices(IServiceCollection services)
{
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
Expand All @@ -50,7 +51,8 @@ public void ConfigureServices(IServiceCollection services)

// Add Identity DbContext
services.AddDbContext<AppIdentityDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection")));
options.UseInMemoryDatabase("Identity"));
// options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection")));

services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<AppIdentityDbContext>()
Expand Down
1 change: 1 addition & 0 deletions src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
Expand Down

0 comments on commit a69afa2

Please sign in to comment.