Фикс получения установок для панели

This commit is contained in:
Степанов Дмитрий 2024-04-18 09:40:43 +03:00
parent e14ff48f4b
commit f188866391
4 changed files with 13 additions and 5 deletions

View File

@ -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);

View File

@ -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();
});

View File

@ -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;
}

View File

@ -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;
@ -63,8 +62,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var filtered = all.Where(s =>
s.IdWell == idWell &&
s.IdState == 1 &&
s.UploadDate.AddSeconds(s.ObsolescenceSec) > DateTime.UtcNow)
.ToList();
s.UploadDate.AddSeconds(s.ObsolescenceSec) > DateTime.UtcNow);
if (!filtered.Any())
return Enumerable.Empty<SetpointsRequestDto>();