Refactor TelemetryDataBaseService.UpdateDataAsync() simplify query.

This commit is contained in:
Фролов 2021-11-10 16:56:41 +05:00
parent bfb76b9dc0
commit 69ed4c5fb8

View File

@ -49,20 +49,11 @@ namespace AsbCloudInfrastructure.Services
var dataSet = db.Set<TModel>(); var dataSet = db.Set<TModel>();
var oldData = await (from d in dataSet //var oldData = dataSet.Where(d=> d.IdTelemetry == idTelemetry
where d.IdTelemetry == idTelemetry // && d.Date > dtoMinDate
&& d.Date > dtoMinDate // && d.Date < dtoMaxDate);
&& d.Date < dtoMaxDate
select d)
.AsNoTracking()
.ToListAsync(token)
.ConfigureAwait(false);
if (oldData.Any()) //dataSet.RemoveRange(oldData);
{
dataSet.RemoveRange(oldData);
await db.SaveChangesAsync(token).ConfigureAwait(false);
}
foreach (var dto in dtos) foreach (var dto in dtos)
{ {