Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 5f3b155

Browse files
authored
Merge pull request #491 from raboud/ContextSeed
Changed AddRange to AddRangeAsync
2 parents fa80266 + 2451ab9 commit 5f3b155

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ await policy.ExecuteAsync(async () =>
3030

3131
if (!context.CatalogBrands.Any())
3232
{
33-
context.CatalogBrands.AddRange(useCustomizationData
33+
await context.CatalogBrands.AddRangeAsync(useCustomizationData
3434
? GetCatalogBrandsFromFile(contentRootPath, logger)
3535
: GetPreconfiguredCatalogBrands());
3636

@@ -39,7 +39,7 @@ await policy.ExecuteAsync(async () =>
3939

4040
if (!context.CatalogTypes.Any())
4141
{
42-
context.CatalogTypes.AddRange(useCustomizationData
42+
await context.CatalogTypes.AddRangeAsync(useCustomizationData
4343
? GetCatalogTypesFromFile(contentRootPath, logger)
4444
: GetPreconfiguredCatalogTypes());
4545

@@ -48,7 +48,7 @@ await policy.ExecuteAsync(async () =>
4848

4949
if (!context.CatalogItems.Any())
5050
{
51-
context.CatalogItems.AddRange(useCustomizationData
51+
await context.CatalogItems.AddRangeAsync(useCustomizationData
5252
? GetCatalogItemsFromFile(contentRootPath, context, logger)
5353
: GetPreconfiguredItems());
5454

src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task SeedAsync(ApplicationDbContext context,IHostingEnvironment env
3333

3434
if (!context.Users.Any())
3535
{
36-
context.Users.AddRange(useCustomizationData
36+
await context.Users.AddRangeAsync(useCustomizationData
3737
? GetUsersFromFile(contentRootPath, logger)
3838
: GetDefaultUser());
3939

src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public async Task SeedAsync(ConfigurationDbContext context, IConfiguration confi
2727

2828
if (!await context.Clients.AnyAsync())
2929
{
30-
context.Clients.AddRange(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
30+
await context.Clients.AddRangeAsync(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
3131
}
3232

3333
if (!await context.IdentityResources.AnyAsync())
3434
{
35-
context.IdentityResources.AddRange(Config.GetResources().Select(resource => resource.ToEntity()));
35+
await context.IdentityResources.AddRangeAsync(Config.GetResources().Select(resource => resource.ToEntity()));
3636
}
3737

3838
if (!await context.ApiResources.AnyAsync())
3939
{
40-
context.ApiResources.AddRange(Config.GetApis().Select(api => api.ToEntity()));
40+
await context.ApiResources.AddRangeAsync(Config.GetApis().Select(api => api.ToEntity()));
4141
}
4242

4343
await context.SaveChangesAsync();

src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ await policy.ExecuteAsync(async () =>
1919
{
2020
if (!context.Campaigns.Any())
2121
{
22-
context.Campaigns.AddRange(
22+
await context.Campaigns.AddRangeAsync(
2323
GetPreconfiguredMarketings());
2424

2525
await context.SaveChangesAsync();

src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ await policy.ExecuteAsync(async () =>
3939

4040
if (!context.CardTypes.Any())
4141
{
42-
context.CardTypes.AddRange(useCustomizationData
42+
await context.CardTypes.AddRangeAsync(useCustomizationData
4343
? GetCardTypesFromFile(contentRootPath, logger)
4444
: GetPredefinedCardTypes());
4545

@@ -48,7 +48,7 @@ await policy.ExecuteAsync(async () =>
4848

4949
if (!context.OrderStatus.Any())
5050
{
51-
context.OrderStatus.AddRange(useCustomizationData
51+
await context.OrderStatus.AddRangeAsync(useCustomizationData
5252
? GetOrderStatusFromFile(contentRootPath, logger)
5353
: GetPredefinedOrderStatus());
5454
}

0 commit comments

Comments
 (0)