Browse Source

Merge pull request #491 from raboud/ContextSeed

Changed AddRange to AddRangeAsync
pull/516/head
Miguel Veloso 7 years ago
committed by GitHub
parent
commit
5f3b1557e6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions
  1. +3
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  2. +1
    -1
      src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs
  3. +3
    -3
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  4. +1
    -1
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs
  5. +2
    -2
      src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs

+ 3
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -30,7 +30,7 @@
if (!context.CatalogBrands.Any())
{
context.CatalogBrands.AddRange(useCustomizationData
await context.CatalogBrands.AddRangeAsync(useCustomizationData
? GetCatalogBrandsFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogBrands());
@ -39,7 +39,7 @@
if (!context.CatalogTypes.Any())
{
context.CatalogTypes.AddRange(useCustomizationData
await context.CatalogTypes.AddRangeAsync(useCustomizationData
? GetCatalogTypesFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogTypes());
@ -48,7 +48,7 @@
if (!context.CatalogItems.Any())
{
context.CatalogItems.AddRange(useCustomizationData
await context.CatalogItems.AddRangeAsync(useCustomizationData
? GetCatalogItemsFromFile(contentRootPath, context, logger)
: GetPreconfiguredItems());


+ 1
- 1
src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs View File

@ -33,7 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
if (!context.Users.Any())
{
context.Users.AddRange(useCustomizationData
await context.Users.AddRangeAsync(useCustomizationData
? GetUsersFromFile(contentRootPath, logger)
: GetDefaultUser());


+ 3
- 3
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -27,17 +27,17 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
if (!await context.Clients.AnyAsync())
{
context.Clients.AddRange(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
await context.Clients.AddRangeAsync(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
}
if (!await context.IdentityResources.AnyAsync())
{
context.IdentityResources.AddRange(Config.GetResources().Select(resource => resource.ToEntity()));
await context.IdentityResources.AddRangeAsync(Config.GetResources().Select(resource => resource.ToEntity()));
}
if (!await context.ApiResources.AnyAsync())
{
context.ApiResources.AddRange(Config.GetApis().Select(api => api.ToEntity()));
await context.ApiResources.AddRangeAsync(Config.GetApis().Select(api => api.ToEntity()));
}
await context.SaveChangesAsync();


+ 1
- 1
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs View File

@ -19,7 +19,7 @@
{
if (!context.Campaigns.Any())
{
context.Campaigns.AddRange(
await context.Campaigns.AddRangeAsync(
GetPreconfiguredMarketings());
await context.SaveChangesAsync();


+ 2
- 2
src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs View File

@ -39,7 +39,7 @@
if (!context.CardTypes.Any())
{
context.CardTypes.AddRange(useCustomizationData
await context.CardTypes.AddRangeAsync(useCustomizationData
? GetCardTypesFromFile(contentRootPath, logger)
: GetPredefinedCardTypes());
@ -48,7 +48,7 @@
if (!context.OrderStatus.Any())
{
context.OrderStatus.AddRange(useCustomizationData
await context.OrderStatus.AddRangeAsync(useCustomizationData
? GetOrderStatusFromFile(contentRootPath, logger)
: GetPredefinedOrderStatus());
}


Loading…
Cancel
Save