Skip to content

Commit

Permalink
Making "any" async (dotnet-architecture#397)
Browse files Browse the repository at this point in the history
* Making "any" async

* Removed unused using

Co-authored-by: Eric Fleming <eric-fleming18@hotmail.com>
  • Loading branch information
yigith and efleming18 authored Jun 15, 2020
1 parent 18589f9 commit 623ec49
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Infrastructure/Data/CatalogContextSeed.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Microsoft.eShopWeb.Infrastructure.Data
Expand All @@ -17,24 +17,23 @@ public static async Task SeedAsync(CatalogContext catalogContext,
{
// TODO: Only run this if using a real database
// context.Database.Migrate();

if (!catalogContext.CatalogBrands.Any())
if (!await catalogContext.CatalogBrands.AnyAsync())
{
catalogContext.CatalogBrands.AddRange(
GetPreconfiguredCatalogBrands());

await catalogContext.SaveChangesAsync();
}

if (!catalogContext.CatalogTypes.Any())
if (!await catalogContext.CatalogTypes.AnyAsync())
{
catalogContext.CatalogTypes.AddRange(
GetPreconfiguredCatalogTypes());

await catalogContext.SaveChangesAsync();
}

if (!catalogContext.CatalogItems.Any())
if (!await catalogContext.CatalogItems.AnyAsync())
{
catalogContext.CatalogItems.AddRange(
GetPreconfiguredItems());
Expand Down

0 comments on commit 623ec49

Please sign in to comment.