From 69ed4c5fb81f2cfb00d7fc9edc1aa676b5fe4139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Wed, 10 Nov 2021 16:56:41 +0500 Subject: [PATCH] Refactor TelemetryDataBaseService.UpdateDataAsync() simplify query. --- .../Services/TelemetryDataBaseService.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/AsbCloudInfrastructure/Services/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/TelemetryDataBaseService.cs index c4126196..959c9774 100644 --- a/AsbCloudInfrastructure/Services/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/TelemetryDataBaseService.cs @@ -49,20 +49,11 @@ namespace AsbCloudInfrastructure.Services var dataSet = db.Set(); - 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) {