Browse Source

Making "any" async (#397)

* Making "any" async

* Removed unused using

Co-authored-by: Eric Fleming <eric-fleming18@hotmail.com>
main
yigith 6 years ago
committed by GitHub
parent
commit
623ec49ed7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/Infrastructure/Data/CatalogContextSeed.cs

11
src/Infrastructure/Data/CatalogContextSeed.cs

@ -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
@ -17,8 +17,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
{
// 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());
@ -26,7 +25,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
await catalogContext.SaveChangesAsync();
}
if (!catalogContext.CatalogTypes.Any())
if (!await catalogContext.CatalogTypes.AnyAsync())
{
catalogContext.CatalogTypes.AddRange(
GetPreconfiguredCatalogTypes());
@ -34,7 +33,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
await catalogContext.SaveChangesAsync();
}
if (!catalogContext.CatalogItems.Any())
if (!await catalogContext.CatalogItems.AnyAsync())
{
catalogContext.CatalogItems.AddRange(
GetPreconfiguredItems());

Loading…
Cancel
Save