Update nugets, fix nit issues, spelling

This commit is contained in:
ngfrolov 2024-07-08 11:09:43 +05:00
parent b19a0e66cf
commit 73f60df7ce
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
17 changed files with 441 additions and 470 deletions

View File

@ -1,6 +1,4 @@
using System.IO; using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services; namespace AsbCloudApp.Services;
@ -13,7 +11,6 @@ public interface IReportMakerService<T>
/// Генерация файла /// Генерация файла
/// </summary> /// </summary>
/// <param name="report">модель с данными для построения отчета</param> /// <param name="report">модель с данными для построения отчета</param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<Stream> MakeReportAsync(T report, CancellationToken cancellationToken); Stream MakeReport(T report);
} }

View File

@ -6,11 +6,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -45,7 +45,7 @@ namespace AsbCloudDb
return builder; return builder;
} }
static Dictionary<Type, IQueryStringFactory> QueryFactories { get; set; } = new(); static Dictionary<Type, IQueryStringFactory> QueryFactories { get; set; } = [];
static QueryStringFactory<T> GetQueryStringFactory<T>(DbSet<T> dbSet) static QueryStringFactory<T> GetQueryStringFactory<T>(DbSet<T> dbSet)
where T : class where T : class
@ -152,21 +152,21 @@ namespace AsbCloudDb
public string TableName { get; } public string TableName { get; }
public IEnumerable<string> Columns { get; } public IEnumerable<string> Columns { get; }
public QueryStringFactory(DbSet<T> dbset) public QueryStringFactory(DbSet<T> dbSet)
{ {
var properties = dbset.EntityType.GetProperties(); var properties = dbSet.EntityType.GetProperties();
var pkColsNames = dbset.EntityType.FindPrimaryKey()?.Properties.Select(p => p.GetColumnBaseName()); var pkColsNames = dbSet.EntityType.FindPrimaryKey()?.Properties.Select(p => p.GetColumnName());
pk = pkColsNames is null ? string.Empty : $"({string.Join(", ", pkColsNames)})"; pk = pkColsNames is null ? string.Empty : $"({string.Join(", ", pkColsNames)})";
TableName = dbset.EntityType.GetTableName()!; TableName = dbSet.EntityType.GetTableName()!;
getters = properties getters = properties
.Where(p => !p.IsShadowProperty()) .Where(p => !p.IsShadowProperty())
.Select(p => p.GetGetter()).ToList(); .Select(p => p.GetGetter()).ToList();
Columns = properties.Select(p => $"\"{p.GetColumnBaseName()}\""); Columns = properties.Select(p => $"\"{p.GetColumnName()}\"");
var colunmsString = $"({string.Join(", ", Columns)})"; var columnsString = $"({string.Join(", ", Columns)})";
insertHeader = $"INSERT INTO {TableName} {colunmsString} VALUES "; insertHeader = $"INSERT INTO {TableName} {columnsString} VALUES ";
var excludedUpdateSet = string.Join(", ", Columns.Select(n => $"{n} = excluded.{n}")); var excludedUpdateSet = string.Join(", ", Columns.Select(n => $"{n} = excluded.{n}"));
conflictBody = $" ON CONFLICT {pk} DO UPDATE SET {excludedUpdateSet};"; conflictBody = $" ON CONFLICT {pk} DO UPDATE SET {excludedUpdateSet};";
} }

View File

@ -2,8 +2,6 @@ using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure namespace AsbCloudInfrastructure
{ {
@ -27,24 +25,5 @@ namespace AsbCloudInfrastructure
return memoryStream; return memoryStream;
} }
[Obsolete]
public static async Task<Stream> GetTemplateCopyStreamAsync(this Assembly assembly,
string templateName,
CancellationToken cancellationToken)
{
var resourceName = assembly
.GetManifestResourceNames()
.FirstOrDefault(n => n.EndsWith(templateName))!;
using var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(resourceName)!;
var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream, cancellationToken);
memoryStream.Position = 0;
return memoryStream;
}
} }
} }

View File

@ -46,9 +46,9 @@ namespace AsbCloudInfrastructure.Repository
return cache!; return cache!;
} }
protected virtual Task<IEnumerable<TEntity>> GetCacheAsync(CancellationToken token) protected virtual async Task<IEnumerable<TEntity>> GetCacheAsync(CancellationToken token)
{ {
var cache = memoryCache.GetOrCreateAsync(CacheTag, async (cacheEntry) => var cache = await memoryCache.GetOrCreateAsync(CacheTag, async (cacheEntry) =>
{ {
cacheEntry.AbsoluteExpirationRelativeToNow = CacheObsolescence; cacheEntry.AbsoluteExpirationRelativeToNow = CacheObsolescence;
cacheEntry.SlidingExpiration = CacheObsolescence; cacheEntry.SlidingExpiration = CacheObsolescence;
@ -57,7 +57,7 @@ namespace AsbCloudInfrastructure.Repository
cacheEntry.Value = entities; cacheEntry.Value = entities;
return entities.AsEnumerable(); return entities.AsEnumerable();
}); });
return cache; return cache!;
} }
} }

View File

@ -30,9 +30,9 @@ public class DailyReportExportService : IDailyReportExportService
private const int columnTimeBalanceDrillingDeviationPerSection = 10; private const int columnTimeBalanceDrillingDeviationPerSection = 10;
private const int columnTimeBalanceDrillingDeviationPerDay = 11; private const int columnTimeBalanceDrillingDeviationPerDay = 11;
private const int columnSheduleDriller = 3; private const int columnScheduleDriller = 3;
private const int columnSheduleShiftStart = 7; private const int columnScheduleShiftStart = 7;
private const int columnSheduleShiftEnd = 8; private const int columnScheduleShiftEnd = 8;
private const int columnSubsystemName = 2; private const int columnSubsystemName = 2;
private const int columnUseSubsystemPerDayUsedTimeHours = 3; private const int columnUseSubsystemPerDayUsedTimeHours = 3;
@ -93,18 +93,18 @@ public class DailyReportExportService : IDailyReportExportService
{ {
var dailyReport = await dailyReportService.GetAsync(idWell, dailyReportDate, cancellationToken); var dailyReport = await dailyReportService.GetAsync(idWell, dailyReportDate, cancellationToken);
var stream = await GenerateFileAsync(dailyReport, cancellationToken); var stream = GenerateFile(dailyReport);
var fileName = $"Суточный_рапорт_по_скважине_{dailyReport.WellCaption}_куст_{dailyReport.Cluster}_от_{dailyReport.Date:yy-MM-dd}.xlsx"; var fileName = $"Суточный_рапорт_по_скважине_{dailyReport.WellCaption}_куст_{dailyReport.Cluster}_от_{dailyReport.Date:yy-MM-dd}.xlsx";
return (fileName, stream); return (fileName, stream);
} }
private static async Task<Stream> GenerateFileAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) private static MemoryStream GenerateFile(DailyReportDto dailyReport)
{ {
using var excelTemplateStream = await Assembly using var excelTemplateStream = Assembly
.GetExecutingAssembly() .GetExecutingAssembly()
.GetTemplateCopyStreamAsync("DailyReportTemplate.xlsx", cancellationToken); .GetTemplateCopyStream("DailyReportTemplate.xlsx");
using var workbook = new XLWorkbook(excelTemplateStream); using var workbook = new XLWorkbook(excelTemplateStream);
@ -178,20 +178,20 @@ public class DailyReportExportService : IDailyReportExportService
private static void AddSubsystemBlockToSheet(IXLWorksheet sheet, SubsystemBlockDto subsystemBlock) private static void AddSubsystemBlockToSheet(IXLWorksheet sheet, SubsystemBlockDto subsystemBlock)
{ {
var rowСurrent = rowStartSubsystemBlock; var rowCurrent = rowStartSubsystemBlock;
foreach (var subsystem in subsystemBlock.Subsystems) foreach (var subsystem in subsystemBlock.Subsystems)
{ {
sheet.Cell(rowСurrent, columnSubsystemName).SetCellValue(subsystem.Name); sheet.Cell(rowCurrent, columnSubsystemName).SetCellValue(subsystem.Name);
sheet.Cell(rowСurrent, columnUseSubsystemPerDayUsedTimeHours).SetCellValue(subsystem.UsagePerDay?.UsedTimeHours); sheet.Cell(rowCurrent, columnUseSubsystemPerDayUsedTimeHours).SetCellValue(subsystem.UsagePerDay?.UsedTimeHours);
sheet.Cell(rowСurrent, columnUseSubsystemPerDaySumDepthInterval).SetCellValue(subsystem.UsagePerDay?.SumDepthInterval); sheet.Cell(rowCurrent, columnUseSubsystemPerDaySumDepthInterval).SetCellValue(subsystem.UsagePerDay?.SumDepthInterval);
sheet.Cell(rowСurrent, columnUseSubsystemPerDayKUsage).SetCellValue(subsystem.UsagePerDay?.KUsage * 100); sheet.Cell(rowCurrent, columnUseSubsystemPerDayKUsage).SetCellValue(subsystem.UsagePerDay?.KUsage * 100);
sheet.Cell(rowСurrent, columnUseSubsystemPerWellUsedTimeHours).SetCellValue(subsystem.UsagePerWell?.UsedTimeHours); sheet.Cell(rowCurrent, columnUseSubsystemPerWellUsedTimeHours).SetCellValue(subsystem.UsagePerWell?.UsedTimeHours);
sheet.Cell(rowСurrent, columnUseSubsystemPerWellSumDepthInterval).SetCellValue(subsystem.UsagePerWell?.SumDepthInterval); sheet.Cell(rowCurrent, columnUseSubsystemPerWellSumDepthInterval).SetCellValue(subsystem.UsagePerWell?.SumDepthInterval);
sheet.Cell(rowСurrent, columnUseSubsystemPerWellKUsage).SetCellValue(subsystem.UsagePerWell?.KUsage * 100); sheet.Cell(rowCurrent, columnUseSubsystemPerWellKUsage).SetCellValue(subsystem.UsagePerWell?.KUsage * 100);
rowСurrent++; rowCurrent++;
} }
sheet.Cell(cellSubsystemComment).SetCellValue(subsystemBlock.Comment); sheet.Cell(cellSubsystemComment).SetCellValue(subsystemBlock.Comment);
@ -207,9 +207,9 @@ public class DailyReportExportService : IDailyReportExportService
foreach (var schedule in scheduleBlock.OrderBy(s => s.ShiftStart)) foreach (var schedule in scheduleBlock.OrderBy(s => s.ShiftStart))
{ {
sheet.Cell(rowCurrent, columnSheduleDriller).SetCellValue($"{schedule.Surname} {schedule.Name} {schedule.Patronymic}"); sheet.Cell(rowCurrent, columnScheduleDriller).SetCellValue($"{schedule.Surname} {schedule.Name} {schedule.Patronymic}");
sheet.Cell(rowCurrent, columnSheduleShiftStart).SetCellValue(schedule.ShiftStart); sheet.Cell(rowCurrent, columnScheduleShiftStart).SetCellValue(schedule.ShiftStart);
sheet.Cell(rowCurrent, columnSheduleShiftEnd).SetCellValue(schedule.ShiftEnd); sheet.Cell(rowCurrent, columnScheduleShiftEnd).SetCellValue(schedule.ShiftEnd);
rowCurrent++; rowCurrent++;
} }

View File

@ -16,9 +16,9 @@ namespace AsbCloudInfrastructure.Services.DrillTestReport
private readonly string sheetName = "Лист1"; private readonly string sheetName = "Лист1";
private readonly int startRowNumber = 8; private readonly int startRowNumber = 8;
public async Task<Stream> MakeReportAsync(DrillTestReportDataDto report, CancellationToken cancellationToken) public Stream MakeReport(DrillTestReportDataDto report)
{ {
using var excelTemplateStream = await Assembly.GetExecutingAssembly().GetTemplateCopyStreamAsync(templateName, cancellationToken); using var excelTemplateStream = Assembly.GetExecutingAssembly().GetTemplateCopyStream(templateName);
using var workbook = new XLWorkbook(excelTemplateStream); using var workbook = new XLWorkbook(excelTemplateStream);

View File

@ -53,7 +53,7 @@ namespace AsbCloudInfrastructure.Services.DrillTestReport
}; };
var fileName = string.Format("Drill_test_{0}.xlsx", dto.TimeStampStart.ToString("dd.mm.yyyy_HH_MM_ss")); var fileName = string.Format("Drill_test_{0}.xlsx", dto.TimeStampStart.ToString("dd.mm.yyyy_HH_MM_ss"));
var stream = await drillTestReportMakerService.MakeReportAsync(report, cancellationToken); var stream = drillTestReportMakerService.MakeReport(report);
return (fileName, stream); return (fileName, stream);
} }

View File

@ -53,8 +53,6 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(idWell); var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(idWell);
var changeLogProcessMapsRotor = await processMapPlanRotorRepository.GetChangeLogForDate(requestProcessMapPlan, null, token); var changeLogProcessMapsRotor = await processMapPlanRotorRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);
var changeLogProcessMapsSlide = await processMapPlanSlideRepository.GetChangeLogForDate(requestProcessMapPlan, null, token); var changeLogProcessMapsSlide = await processMapPlanSlideRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);

View File

@ -110,7 +110,7 @@ public class TelemetryDataCache<TDto> : ITelemetryDataCache<TDto> where TDto : A
var cacheLastData = cacheItem.LastData; var cacheLastData = cacheItem.LastData;
if (!cacheLastData.Any() || cacheLastData[0].DateTime > dateBegin) if (cacheLastData.Count == 0 || cacheLastData[0].DateTime > dateBegin)
return null; return null;
var dateEnd = dateBegin.AddSeconds(intervalSec); var dateEnd = dateBegin.AddSeconds(intervalSec);
@ -150,7 +150,7 @@ public class TelemetryDataCache<TDto> : ITelemetryDataCache<TDto> where TDto : A
if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem)) if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem))
return null; return null;
if (!cacheItem.LastData.Any()) if (cacheItem.LastData.Count == 0)
return null; return null;
var to = FromDate(cacheItem.FirstByDate.DateTime, cacheItem.TimezoneOffset); var to = FromDate(cacheItem.FirstByDate.DateTime, cacheItem.TimezoneOffset);
@ -178,7 +178,7 @@ public class TelemetryDataCache<TDto> : ITelemetryDataCache<TDto> where TDto : A
if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem)) if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem))
return null; return null;
if (!cacheItem.LastData.Any()) if (cacheItem.LastData.Count == 0)
return null; return null;
var last = cacheItem.LastData[^1]; var last = cacheItem.LastData[^1];

View File

@ -74,7 +74,7 @@ public class WellInfoService
var i = 0d; var i = 0d;
WellMapInfo = activeWells.Select(well => WellMapInfo = activeWells.Select(well =>
{ {
var wellMapInfo = well.Adapt<WellMapInfoWithComanies>(); var wellMapInfo = well.Adapt<WellMapInfoWithCompanies>();
wellMapInfo.IdState = well.IdState; wellMapInfo.IdState = well.IdState;
onProgressCallback($"Start updating info by well({well.Id}): {well.Caption}", i++ / count); onProgressCallback($"Start updating info by well({well.Id}): {well.Caption}", i++ / count);
double? currentDepth = null; double? currentDepth = null;
@ -208,7 +208,7 @@ public class WellInfoService
} }
} }
class WellMapInfoWithComanies : WellMapInfoDto class WellMapInfoWithCompanies : WellMapInfoDto
{ {
public int? IdTelemetry { get; set; } public int? IdTelemetry { get; set; }
public IEnumerable<int> IdsCompanies { get; set; } = null!; public IEnumerable<int> IdsCompanies { get; set; } = null!;
@ -219,7 +219,7 @@ public class WellInfoService
private readonly IWitsRecordRepository<Record7Dto> witsRecord7Repository; private readonly IWitsRecordRepository<Record7Dto> witsRecord7Repository;
private readonly IWitsRecordRepository<Record1Dto> witsRecord1Repository; private readonly IWitsRecordRepository<Record1Dto> witsRecord1Repository;
private readonly IGtrRepository gtrRepository; private readonly IGtrRepository gtrRepository;
private static IEnumerable<WellMapInfoWithComanies> WellMapInfo = Enumerable.Empty<WellMapInfoWithComanies>(); private static IEnumerable<WellMapInfoWithCompanies> WellMapInfo = [];
public WellInfoService( public WellInfoService(
ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataSaubCache, ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataSaubCache,
@ -236,7 +236,7 @@ public class WellInfoService
this.gtrRepository = gtrRepository; this.gtrRepository = gtrRepository;
} }
private WellMapInfoWithTelemetryStat Convert(WellMapInfoWithComanies wellInfo) private WellMapInfoWithTelemetryStat Convert(WellMapInfoWithCompanies wellInfo)
{ {
var result = wellInfo.Adapt<WellMapInfoWithTelemetryStat>(); var result = wellInfo.Adapt<WellMapInfoWithTelemetryStat>();
if (wellInfo.IdTelemetry.HasValue) if (wellInfo.IdTelemetry.HasValue)
@ -271,8 +271,8 @@ public class WellInfoService
public WellMapInfoWithTelemetryStat? FirstOrDefault(Func<WellMapInfoDto, bool> predicate) public WellMapInfoWithTelemetryStat? FirstOrDefault(Func<WellMapInfoDto, bool> predicate)
{ {
var first = WellMapInfo.FirstOrDefault(predicate); var first = WellMapInfo.FirstOrDefault(predicate);
if (first is WellMapInfoWithComanies wellMapInfoWithComanies) if (first is WellMapInfoWithCompanies wellMapInfoWithCompanies)
return Convert(wellMapInfoWithComanies); return Convert(wellMapInfoWithCompanies);
return null; return null;
} }

View File

@ -8,11 +8,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.26" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Refit" Version="7.0.0" /> <PackageReference Include="Refit" Version="7.1.2" />
<PackageReference Include="xunit" Version="2.6.6" /> <PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> <PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View File

@ -17,11 +17,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.26" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" /> <PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.6" /> <PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> <PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View File

@ -10,16 +10,16 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.26" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="8.0.1"> <PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="8.0.6">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="protobuf-net" Version="3.2.30" /> <PackageReference Include="protobuf-net" Version="3.2.30" />
<PackageReference Include="protobuf-net.AspNetCore" Version="3.2.12" /> <PackageReference Include="protobuf-net.AspNetCore" Version="3.2.12" />
<PackageReference Include="SignalRSwaggerGen" Version="4.5.0" /> <PackageReference Include="SignalRSwaggerGen" Version="4.7.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.6.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,25 +1,25 @@
using AsbCloudApp.Data.SAUB; using AsbCloudApp.Data.SAUB;
using ProtoBuf.Meta; using ProtoBuf.Meta;
namespace AsbCloudWebApi namespace AsbCloudWebApi;
public static class ProtobufModel
{ {
public static class ProtobufModel
{
private static readonly object SyncRoot = new(); private static readonly object SyncRoot = new();
public static void EnshureRegistered() public static void EnsureRegistered()
{ {
lock (SyncRoot) lock (SyncRoot)
{ {
EnshureRegisteredDataSpin(); EnsureRegisteredDataSpin();
EnshureRegisteredDataSaub(); EnsureRegisteredDataSaub();
EnshureRegisteredWITS(); EnsureRegisteredWITS();
EnshureRegisteredWirelineRunOutBaseDto(); EnsureRegisteredWirelineRunOutBaseDto();
EnshureRegisteredWirelineRunOutDto(); EnsureRegisteredWirelineRunOutDto();
} }
} }
private static void EnshureRegisteredWirelineRunOutBaseDto() private static void EnsureRegisteredWirelineRunOutBaseDto()
{ {
var type = typeof(TelemetryWirelineRunOutBaseDto); var type = typeof(TelemetryWirelineRunOutBaseDto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -32,7 +32,7 @@ namespace AsbCloudWebApi
.Add(5, nameof(TelemetryWirelineRunOutBaseDto.ReplaceWarnSp)); .Add(5, nameof(TelemetryWirelineRunOutBaseDto.ReplaceWarnSp));
} }
private static void EnshureRegisteredWirelineRunOutDto() private static void EnsureRegisteredWirelineRunOutDto()
{ {
var type = typeof(TelemetryWirelineRunOutDto); var type = typeof(TelemetryWirelineRunOutDto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -45,17 +45,17 @@ namespace AsbCloudWebApi
.Add(5, nameof(TelemetryWirelineRunOutDto.ReplaceWarnSp)); .Add(5, nameof(TelemetryWirelineRunOutDto.ReplaceWarnSp));
} }
private static void EnshureRegisteredWITS() private static void EnsureRegisteredWITS()
{ {
EnshureRegisteredRecord1(); EnsureRegisteredRecord1();
EnshureRegisteredRecord7(); EnsureRegisteredRecord7();
EnshureRegisteredRecord8(); EnsureRegisteredRecord8();
EnshureRegisteredRecord50(); EnsureRegisteredRecord50();
EnshureRegisteredRecord60(); EnsureRegisteredRecord60();
EnshureRegisteredRecord61(); EnsureRegisteredRecord61();
} }
private static void EnshureRegisteredRecord1() private static void EnsureRegisteredRecord1()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record1Dto); var type = typeof(AsbCloudApp.Data.WITS.Record1Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -114,7 +114,7 @@ namespace AsbCloudWebApi
; ;
} }
private static void EnshureRegisteredRecord7() private static void EnsureRegisteredRecord7()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record7Dto); var type = typeof(AsbCloudApp.Data.WITS.Record7Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -154,7 +154,7 @@ namespace AsbCloudWebApi
; ;
} }
private static void EnshureRegisteredRecord8() private static void EnsureRegisteredRecord8()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record8Dto); var type = typeof(AsbCloudApp.Data.WITS.Record8Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -223,7 +223,7 @@ namespace AsbCloudWebApi
; ;
} }
private static void EnshureRegisteredRecord60() private static void EnsureRegisteredRecord60()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record60Dto); var type = typeof(AsbCloudApp.Data.WITS.Record60Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -247,7 +247,7 @@ namespace AsbCloudWebApi
; ;
} }
private static void EnshureRegisteredRecord61() private static void EnsureRegisteredRecord61()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record61Dto); var type = typeof(AsbCloudApp.Data.WITS.Record61Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -272,7 +272,7 @@ namespace AsbCloudWebApi
; ;
} }
private static void EnshureRegisteredRecord50() private static void EnsureRegisteredRecord50()
{ {
var type = typeof(AsbCloudApp.Data.WITS.Record50Dto); var type = typeof(AsbCloudApp.Data.WITS.Record50Dto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -305,9 +305,7 @@ namespace AsbCloudWebApi
; ;
} }
static void EnsureRegisteredDataSpin()
static void EnshureRegisteredDataSpin()
{ {
var type = typeof(TelemetryDataSpinDto); var type = typeof(TelemetryDataSpinDto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -327,7 +325,7 @@ namespace AsbCloudWebApi
.Add(64, nameof(TelemetryDataSpinDto.State)); .Add(64, nameof(TelemetryDataSpinDto.State));
} }
static void EnshureRegisteredDataSaub() static void EnsureRegisteredDataSaub()
{ {
var type = typeof(TelemetryDataSaubDto); var type = typeof(TelemetryDataSaubDto);
if (RuntimeTypeModel.Default.IsDefined(type)) if (RuntimeTypeModel.Default.IsDefined(type))
@ -376,5 +374,4 @@ namespace AsbCloudWebApi
.Add(41, nameof(TelemetryDataSaubDto.Pump1Flow)) .Add(41, nameof(TelemetryDataSaubDto.Pump1Flow))
.Add(42, nameof(TelemetryDataSaubDto.Pump2Flow)); .Add(42, nameof(TelemetryDataSaubDto.Pump2Flow));
} }
}
} }

View File

@ -38,7 +38,7 @@ namespace AsbCloudWebApi
services.AddControllers(options => options.UseDateOnlyTimeOnlyStringConverters()); services.AddControllers(options => options.UseDateOnlyTimeOnlyStringConverters());
ProtobufModel.EnshureRegistered(); ProtobufModel.EnsureRegistered();
services.AddSwagger(); services.AddSwagger();

View File

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.5" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
</ItemGroup> </ItemGroup>
</Project> </Project>