Merge branch 'EFpro' into ICrud_refactor

This commit is contained in:
ngfrolov 2022-06-09 13:36:42 +05:00
commit c9d150d3a9
4 changed files with 6 additions and 50 deletions

View File

@ -23,7 +23,7 @@ namespace AsbCloudApp.Data
public double? Longitude { get; set; }
/// <inheritdoc/>
public SimpleTimezoneDto Timezone { get; set; } = null!;
public SimpleTimezoneDto? Timezone { get; set; }
/// <summary>
/// ИД месторождения, необязательный
@ -38,7 +38,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// Список скважин куста
/// </summary>
public IEnumerable<WellDto> Wells { get; set; } = null!;
public IEnumerable<WellDto>? Wells { get; set; } = null!;
}
#nullable disable
}

View File

@ -36,5 +36,9 @@ namespace AsbCloudApp.Data
=> Hours.GetHashCode()
| TimezoneId.GetHashCode()
| IsOverride.GetHashCode();
/// <inheritdoc/>
public override string ToString()
=> $"{TimezoneId} (UTC+{Hours:00.##})";
}
}

View File

@ -89,18 +89,6 @@ namespace AsbCloudInfrastructure.EfCache
try
{
cache = new CacheItem();
var dateObsolete = DateTime.Now + obsolete;
var dateQueryStart = DateTime.Now;
var data = valueFactory();
var queryTime = DateTime.Now - dateQueryStart;
if (dateObsolete - DateTime.Now < minCacheTime)
dateObsolete = DateTime.Now + minCacheTime;
cache.Data = data;
cache.DateObsolete = dateObsolete;
cache.DateObsoleteTotal = dateObsolete + queryTime + minCacheTime;
caches.Add(tag, cache);
}
catch
@ -182,18 +170,6 @@ namespace AsbCloudInfrastructure.EfCache
try
{
cache = new CacheItem();
var dateObsolete = DateTime.Now + obsolete;
var dateQueryStart = DateTime.Now;
var data = await valueFactoryAsync(token);
var queryTime = DateTime.Now - dateQueryStart;
if (dateObsolete - DateTime.Now < minCacheTime)
dateObsolete = DateTime.Now + minCacheTime;
cache.Data = data;
cache.DateObsolete = dateObsolete;
cache.DateObsoleteTotal = dateObsolete + queryTime + minCacheTime;
caches.Add(tag, cache);
}
catch

View File

@ -85,18 +85,6 @@ namespace AsbCloudInfrastructure.EfCache
{
try {
cache = new CacheItem();
var dateObsolete = DateTime.Now + obsolete;
var dateQueryStart = DateTime.Now;
var data = valueFactory();
var queryTime = DateTime.Now - dateQueryStart;
if (dateObsolete - DateTime.Now < minCacheTime)
dateObsolete = DateTime.Now + minCacheTime;
cache.Data = data;
cache.DateObsolete = dateObsolete;
cache.DateObsoleteTotal = dateObsolete + queryTime + minCacheTime;
caches.Add(tag, cache);
}
catch
@ -178,18 +166,6 @@ namespace AsbCloudInfrastructure.EfCache
try
{
cache = new CacheItem();
var dateObsolete = DateTime.Now + obsolete;
var dateQueryStart = DateTime.Now;
var data = await valueFactoryAsync(token);
var queryTime = DateTime.Now - dateQueryStart;
if (dateObsolete - DateTime.Now < minCacheTime)
dateObsolete = DateTime.Now + minCacheTime;
cache.Data = data;
cache.DateObsolete = dateObsolete;
cache.DateObsoleteTotal = dateObsolete + queryTime + minCacheTime;
caches.Add(tag, cache);
}
catch