forked from ddrilling/AsbCloudServer
Рефактор
This commit is contained in:
parent
a4ff666b97
commit
e81abc86e6
@ -89,28 +89,13 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
Count = query.Count()
|
||||
};
|
||||
|
||||
var hasAllSortedFieldsInDBOType = false;
|
||||
|
||||
if (sortFields?.Any() == true)
|
||||
{
|
||||
hasAllSortedFieldsInDBOType = hasAllFieldsInType<TelemetryMessage>(sortFields);
|
||||
if (hasAllSortedFieldsInDBOType)
|
||||
{
|
||||
query = query
|
||||
.SortBy(request.SortFields)
|
||||
.Skip(skip)
|
||||
.Take(take);
|
||||
}
|
||||
query = query.SortBy(request.SortFields);
|
||||
}
|
||||
else
|
||||
{
|
||||
query = query
|
||||
.Skip(skip)
|
||||
.Take(take);
|
||||
}
|
||||
|
||||
var messagesList = await query.AsNoTracking()
|
||||
.ToListAsync(token).ConfigureAwait(false);
|
||||
var messagesList = await query.Skip(skip)
|
||||
.Take(take).AsNoTracking()
|
||||
.ToListAsync(token).ConfigureAwait(false);
|
||||
|
||||
if (messagesList.Count == 0)
|
||||
return result;
|
||||
@ -150,14 +135,6 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
result.Items.Add(messageDto);
|
||||
}
|
||||
|
||||
if (sortFields?.Any() == true && !hasAllSortedFieldsInDBOType)
|
||||
{
|
||||
result.Items = result.Items.AsQueryable()
|
||||
.SortBy(request.SortFields)
|
||||
.Skip(skip)
|
||||
.Take(take)
|
||||
.ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user