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 oldData = await (from d in dataSet
where d.IdTelemetry == idTelemetry
&& d.Date > dtoMinDate
&& d.Date < dtoMaxDate
select d)
.AsNoTracking()
.ToListAsync(token)
.ConfigureAwait(false);
//var oldData = dataSet.Where(d=> d.IdTelemetry == idTelemetry
// && d.Date > dtoMinDate
// && d.Date < dtoMaxDate);
if (oldData.Any())
{
dataSet.RemoveRange(oldData);
await db.SaveChangesAsync(token).ConfigureAwait(false);
}
//dataSet.RemoveRange(oldData);
foreach (var dto in dtos)
{