diff --git a/src/VirtoCommerce.Platform.Data/Repositories/PlatformRepository.cs b/src/VirtoCommerce.Platform.Data/Repositories/PlatformRepository.cs index fc1ef7f54df..15efff5a4e9 100644 --- a/src/VirtoCommerce.Platform.Data/Repositories/PlatformRepository.cs +++ b/src/VirtoCommerce.Platform.Data/Repositories/PlatformRepository.cs @@ -35,7 +35,9 @@ public virtual async Task GetObjectDynamicPropertiesAsy { var properties = await DynamicProperties.Include(x => x.DisplayNames) .OrderBy(x => x.Name) - .Where(x => objectTypes.Contains(x.ObjectType)).ToArrayAsync(); + .Where(x => objectTypes.Contains(x.ObjectType)) + .AsSplitQuery() + .ToArrayAsync(); return properties; } @@ -48,6 +50,7 @@ public virtual async Task GetDynamicPrope var retVal = await DynamicPropertyDictionaryItems.Include(x => x.DisplayNames) .Where(x => ids.Contains(x.Id)) + .AsSplitQuery() .ToArrayAsync(); return retVal; } @@ -62,6 +65,7 @@ public virtual async Task GetDynamicPropertiesByIdsAsyn var retVal = await DynamicProperties.Include(x => x.DisplayNames) .Where(x => ids.Contains(x.Id)) .OrderBy(x => x.Name) + .AsSplitQuery() .ToArrayAsync(); return retVal; } @@ -76,6 +80,7 @@ public virtual async Task GetDynamicPropertiesForTypesA var retVal = await DynamicProperties.Include(p => p.DisplayNames) .Where(p => objectTypes.Contains(p.ObjectType)) .OrderBy(p => p.Name) + .AsSplitQuery() .ToArrayAsync(); return retVal; } @@ -87,6 +92,7 @@ public virtual async Task GetObjectSettingsByNamesAsync(string[ .Where(x => x.ObjectId == objectId && x.ObjectType == objectType) .Where(x => names.Contains(x.Name)) .OrderBy(x => x.Name) + .AsSplitQuery() .ToArrayAsync(); return result; } diff --git a/src/VirtoCommerce.Platform.Data/Settings/SettingsManager.cs b/src/VirtoCommerce.Platform.Data/Settings/SettingsManager.cs index 454ee4bc292..d52a85aaefb 100644 --- a/src/VirtoCommerce.Platform.Data/Settings/SettingsManager.cs +++ b/src/VirtoCommerce.Platform.Data/Settings/SettingsManager.cs @@ -168,6 +168,7 @@ public virtual async Task SaveObjectSettingsAsync(IEnumerable s.SettingValues) .Where(x => settingNames.Contains(x.Name)) + .AsSplitQuery() .ToListAsync()); var validator = new ObjectSettingEntryValidator(); diff --git a/src/VirtoCommerce.Platform.Security/Services/UserSearchService.cs b/src/VirtoCommerce.Platform.Security/Services/UserSearchService.cs index 17b6e4827da..33fc7b65393 100644 --- a/src/VirtoCommerce.Platform.Security/Services/UserSearchService.cs +++ b/src/VirtoCommerce.Platform.Security/Services/UserSearchService.cs @@ -85,7 +85,13 @@ public async Task SearchUsersAsync(UserSearchCriteria criteria { sortInfos = new[] { new SortInfo { SortColumn = ReflectionUtility.GetPropertyName(x => x.UserName), SortDirection = SortDirection.Descending } }; } - result.Results = await query.OrderBySortInfos(sortInfos).Skip(criteria.Skip).Take(criteria.Take).ToArrayAsync(); + + result.Results = await query + .OrderBySortInfos(sortInfos) + .Skip(criteria.Skip) + .Take(criteria.Take) + .AsSplitQuery() + .ToArrayAsync(); foreach (var user in result.Results) { diff --git a/src/VirtoCommerce.Platform.Web/Controllers/Api/AppsController.cs b/src/VirtoCommerce.Platform.Web/Controllers/Api/AppsController.cs index ffe7ea32604..e7269fd4077 100644 --- a/src/VirtoCommerce.Platform.Web/Controllers/Api/AppsController.cs +++ b/src/VirtoCommerce.Platform.Web/Controllers/Api/AppsController.cs @@ -44,4 +44,4 @@ public IEnumerable GetApps() return apps; } -} +} \ No newline at end of file diff --git a/src/VirtoCommerce.Platform.Web/Licensing/LicenseProvider.cs b/src/VirtoCommerce.Platform.Web/Licensing/LicenseProvider.cs index 4f1fae41b40..08cc56f11fb 100644 --- a/src/VirtoCommerce.Platform.Web/Licensing/LicenseProvider.cs +++ b/src/VirtoCommerce.Platform.Web/Licensing/LicenseProvider.cs @@ -23,7 +23,7 @@ public License GetLicense() using (var repository = _platformRepositoryFactory()) { - rawLicenseData = repository.RawLicenses?.FirstOrDefault()?.Data; + rawLicenseData = repository.RawLicenses.OrderBy(x => x.Id).FirstOrDefault()?.Data; } var license = License.Parse(rawLicenseData, _platformOptions.LicensePublicKeyResourceName); @@ -40,13 +40,13 @@ public void SaveLicense(License license) { using (var repository = _platformRepositoryFactory()) { - var rawLicense = repository.RawLicenses?.FirstOrDefault(); + var rawLicense = repository.RawLicenses.OrderBy(x => x.Id).FirstOrDefault(); if (rawLicense == null) { rawLicense = new Data.Model.RawLicenseEntity(); repository.Add(rawLicense); } - rawLicense.Data = license.RawLicense; + rawLicense.Data = license.RawLicense; repository.UnitOfWork.Commit(); } }