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