forked from ddrilling/AsbCloudServer
Фикс получения установок для панели
This commit is contained in:
parent
e14ff48f4b
commit
f188866391
@ -52,6 +52,11 @@ namespace AsbCloudInfrastructure
|
||||
{
|
||||
public static void MapsterSetup()
|
||||
{
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<SetpointsRequestDto, SetpointsRequest>()
|
||||
.Ignore(source => source.Author)
|
||||
.Ignore(source => source.Well);
|
||||
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<DetectedOperationDto, DetectedOperation>()
|
||||
.Ignore(source => source.OperationCategory);
|
||||
|
@ -53,7 +53,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
cacheEntry.AbsoluteExpirationRelativeToNow = CacheObsolescence;
|
||||
cacheEntry.SlidingExpiration = CacheObsolescence;
|
||||
|
||||
var entities = await this.GetQuery().ToArrayAsync(token);
|
||||
var entities = await GetQuery().AsNoTracking().ToArrayAsync(token);
|
||||
cacheEntry.Value = entities;
|
||||
return entities.AsEnumerable();
|
||||
});
|
||||
|
@ -40,9 +40,14 @@ namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
var entity = Convert(dto);
|
||||
var entry = dbSet.Update(entity);
|
||||
entry.State = EntityState.Detached;
|
||||
}
|
||||
|
||||
var affected = await dbContext.SaveChangesAsync(token);
|
||||
|
||||
if(affected > 0)
|
||||
DropCache();
|
||||
|
||||
return affected;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -62,9 +61,8 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
var all = await setpointsRepository.GetAllAsync(token);
|
||||
var filtered = all.Where(s =>
|
||||
s.IdWell == idWell &&
|
||||
s.IdState == 1 &&
|
||||
s.UploadDate.AddSeconds(s.ObsolescenceSec) > DateTime.UtcNow)
|
||||
.ToList();
|
||||
s.IdState == 1 &&
|
||||
s.UploadDate.AddSeconds(s.ObsolescenceSec) > DateTime.UtcNow);
|
||||
|
||||
if (!filtered.Any())
|
||||
return Enumerable.Empty<SetpointsRequestDto>();
|
||||
|
Loading…
Reference in New Issue
Block a user