Making "any" async (#397)
* Making "any" async * Removed unused using Co-authored-by: Eric Fleming <eric-fleming18@hotmail.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopWeb.Infrastructure.Data
|
namespace Microsoft.eShopWeb.Infrastructure.Data
|
||||||
@@ -17,8 +17,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
|||||||
{
|
{
|
||||||
// TODO: Only run this if using a real database
|
// TODO: Only run this if using a real database
|
||||||
// context.Database.Migrate();
|
// context.Database.Migrate();
|
||||||
|
if (!await catalogContext.CatalogBrands.AnyAsync())
|
||||||
if (!catalogContext.CatalogBrands.Any())
|
|
||||||
{
|
{
|
||||||
catalogContext.CatalogBrands.AddRange(
|
catalogContext.CatalogBrands.AddRange(
|
||||||
GetPreconfiguredCatalogBrands());
|
GetPreconfiguredCatalogBrands());
|
||||||
@@ -26,7 +25,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
|||||||
await catalogContext.SaveChangesAsync();
|
await catalogContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!catalogContext.CatalogTypes.Any())
|
if (!await catalogContext.CatalogTypes.AnyAsync())
|
||||||
{
|
{
|
||||||
catalogContext.CatalogTypes.AddRange(
|
catalogContext.CatalogTypes.AddRange(
|
||||||
GetPreconfiguredCatalogTypes());
|
GetPreconfiguredCatalogTypes());
|
||||||
@@ -34,7 +33,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
|||||||
await catalogContext.SaveChangesAsync();
|
await catalogContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!catalogContext.CatalogItems.Any())
|
if (!await catalogContext.CatalogItems.AnyAsync())
|
||||||
{
|
{
|
||||||
catalogContext.CatalogItems.AddRange(
|
catalogContext.CatalogItems.AddRange(
|
||||||
GetPreconfiguredItems());
|
GetPreconfiguredItems());
|
||||||
|
|||||||
Reference in New Issue
Block a user