diff --git a/AsbCloudApp/Data/PaginationContainer.cs b/AsbCloudApp/Data/PaginationContainer.cs index bdee31be..61840893 100644 --- a/AsbCloudApp/Data/PaginationContainer.cs +++ b/AsbCloudApp/Data/PaginationContainer.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; namespace AsbCloudApp.Data { @@ -13,16 +14,7 @@ namespace AsbCloudApp.Data /// public PaginationContainer() { - Items = new List(4); - } - - /// - /// конструктор - /// - /// - public PaginationContainer(int capacity) - { - Items = new List(capacity); + Items = Enumerable.Empty(); } /// @@ -43,6 +35,6 @@ namespace AsbCloudApp.Data /// /// Данные /// - public List Items { get; set; } + public IEnumerable Items { get; set; } } } diff --git a/AsbCloudInfrastructure/Repository/FileRepository.cs b/AsbCloudInfrastructure/Repository/FileRepository.cs index 7b078e10..e75e7691 100644 --- a/AsbCloudInfrastructure/Repository/FileRepository.cs +++ b/AsbCloudInfrastructure/Repository/FileRepository.cs @@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Repository .ToListAsync(token) .ConfigureAwait(false); - result.Items = entities.Select(e => Convert(e)).ToList(); + result.Items = entities.Select(e => Convert(e)); return result; } diff --git a/AsbCloudInfrastructure/Repository/NotificationRepository.cs b/AsbCloudInfrastructure/Repository/NotificationRepository.cs index 90799208..8a44a418 100644 --- a/AsbCloudInfrastructure/Repository/NotificationRepository.cs +++ b/AsbCloudInfrastructure/Repository/NotificationRepository.cs @@ -70,14 +70,14 @@ public class NotificationRepository : CrudCacheRepositoryBase x.Adapt()) - .ToListAsync(cancellationToken); + .ToArrayAsync(cancellationToken); return result; } diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs index 00c87dbb..5d4795cb 100644 --- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs @@ -165,7 +165,7 @@ namespace AsbCloudInfrastructure.Repository .Skip(result.Skip) .Take(result.Take); - result.Items = await query.ToListAsync(token); + result.Items = await query.ToArrayAsync(token); return result; } diff --git a/AsbCloudInfrastructure/Services/SAUB/MessageService.cs b/AsbCloudInfrastructure/Services/SAUB/MessageService.cs index 7b49d5c8..82f0abfc 100644 --- a/AsbCloudInfrastructure/Services/SAUB/MessageService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/MessageService.cs @@ -101,6 +101,8 @@ namespace AsbCloudInfrastructure.Services.SAUB var eventsDict = events.ToDictionary(x=>x.IdEvent, x => x); var usersDict = users.ToDictionary(x => x.IdUser, x => x); + var messagesDtoList = new List(); + foreach (var message in messagesList) { var messageDto = new MessageDto @@ -126,10 +128,11 @@ namespace AsbCloudInfrastructure.Services.SAUB messageDto.CategoryId = e.IdCategory; messageDto.Message = e.MakeMessageText(message); } - - result.Items.Add(messageDto); + messagesDtoList.Add(messageDto); } + result.Items = result.Items.Concat(messagesDtoList); + return result; }