forked from ddrilling/AsbCloudServer
Refactor TelemetryDataBaseService.UpdateDataAsync() simplify query.
This commit is contained in:
parent
bfb76b9dc0
commit
69ed4c5fb8
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user