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 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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user