Skip to content

Commit 5027c54

Browse files
Ensure all lists of inner entities are consistently sorted before serializing to prevent uda exports due to order changes
1 parent fe647cd commit 5027c54

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceCurrencyServiceConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Umbraco.Commerce.Core.Api;
@@ -68,7 +68,7 @@ public override CurrencyArtifact GetArtifact(GuidUdi udi, CurrencyReadOnly entit
6868
{
6969
var allowedCountryArtifacts = new List<AllowedCountryArtifact>();
7070

71-
foreach (var allowedCountry in entity.AllowedCountries)
71+
foreach (var allowedCountry in entity.AllowedCountries.OrderBy(x => x.CountryId))
7272
{
7373
var countryDepUdi = new GuidUdi(UmbracoCommerceConstants.UdiEntityType.Country, allowedCountry.CountryId);
7474
var countryDep = new UmbracoCommerceArtifactDependency(countryDepUdi);

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommercePaymentMethodServiceConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Umbraco.Commerce.Core.Api;
@@ -89,7 +89,7 @@ public override PaymentMethodArtifact GetArtifact(GuidUdi udi, PaymentMethodRead
8989
{
9090
var servicesPrices = new List<ServicePriceArtifact>();
9191

92-
foreach (var price in entity.Prices)
92+
foreach (var price in entity.Prices.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId).ThenBy(x => x.CurrencyId))
9393
{
9494
var spArtifact = new ServicePriceArtifact { Value = price.Value };
9595

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceShippingMethodServiceConnector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Umbraco.Commerce.Core.Api;
@@ -80,7 +80,7 @@ public override ShippingMethodArtifact GetArtifact(GuidUdi udi, ShippingMethodRe
8080
{
8181
var servicesPrices = new List<ServicePriceArtifact>();
8282

83-
foreach (var price in entity.Prices)
83+
foreach (var price in entity.Prices.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId).ThenBy(x => x.CurrencyId))
8484
{
8585
var spArtifact = new ServicePriceArtifact { Value = price.Value };
8686

@@ -125,7 +125,7 @@ public override ShippingMethodArtifact GetArtifact(GuidUdi udi, ShippingMethodRe
125125
{
126126
var allowedCountryRegions = new List<AllowedCountryRegionArtifact>();
127127

128-
foreach (var acr in entity.AllowedCountryRegions)
128+
foreach (var acr in entity.AllowedCountryRegions.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId))
129129
{
130130
var acrArtifact = new AllowedCountryRegionArtifact();
131131

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceStoreServiceConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public override StoreArtifact GetArtifact(GuidUdi udi, StoreReadOnly entity)
167167
{
168168
var users = new List<string>();
169169

170-
foreach (var id in entity.AllowedUsers)
170+
foreach (var id in entity.AllowedUsers.OrderBy(x => x.UserId))
171171
{
172172
var user = _userService.GetByProviderKey(id.UserId);
173173
if (user != null)
@@ -190,7 +190,7 @@ public override StoreArtifact GetArtifact(GuidUdi udi, StoreReadOnly entity)
190190
{
191191
var userRoles = new List<string>();
192192

193-
foreach (var role in entity.AllowedUserRoles)
193+
foreach (var role in entity.AllowedUserRoles.OrderBy(x => x.Role))
194194
{
195195
var userGroup = _userService.GetUserGroupByAlias(role.Role);
196196
if (userGroup != null)

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceTaxClassServiceConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Umbraco.Commerce.Core.Api;
@@ -66,7 +66,7 @@ public override TaxClassArtifact GetArtifact(GuidUdi udi, TaxClassReadOnly entit
6666
// Country region tax rates
6767
var countryRegionTaxRateArtifacts = new List<CountryRegionTaxRateArtifact>();
6868

69-
foreach (var countryRegionTaxRate in entity.CountryRegionTaxRates)
69+
foreach (var countryRegionTaxRate in entity.CountryRegionTaxRates.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId))
7070
{
7171
var crtrArtifact = new CountryRegionTaxRateArtifact
7272
{

0 commit comments

Comments
 (0)