forked from ddrilling/AsbCloudServer
fix nullable warnings
This commit is contained in:
parent
12ff470d5f
commit
e634094738
@ -33,8 +33,11 @@ namespace AsbCloudDb
|
|||||||
s => System.Text.Json.JsonSerializer.Deserialize<TProperty>(s, jsonSerializerOptions)!);
|
s => System.Text.Json.JsonSerializer.Deserialize<TProperty>(s, jsonSerializerOptions)!);
|
||||||
|
|
||||||
ValueComparer<TProperty> valueComparer = new (
|
ValueComparer<TProperty> valueComparer = new (
|
||||||
(a,b) => a.GetHashCode() == b.GetHashCode(),
|
(a,b) =>
|
||||||
i => i.GetHashCode(),
|
(a!=null) && (b != null)
|
||||||
|
? a.GetHashCode() == b.GetHashCode()
|
||||||
|
: (a == null) && (b == null),
|
||||||
|
i => (i == null) ?-1 : i.GetHashCode(),
|
||||||
i => i);
|
i => i);
|
||||||
|
|
||||||
builder.Metadata.SetValueComparer(valueComparer);
|
builder.Metadata.SetValueComparer(valueComparer);
|
||||||
|
@ -345,14 +345,15 @@ namespace AsbCloudDb.Model
|
|||||||
FillData(modelBuilder);
|
FillData(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token = default)
|
public Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token)
|
||||||
where TEntity : class
|
where TEntity : class
|
||||||
{
|
{
|
||||||
var materializedViewName = Set<TEntity>().EntityType.GetViewName();
|
var materializedViewName = Set<TEntity>().EntityType.GetViewName()
|
||||||
return RefreshMaterializedViewAsync(materializedViewName!, token);
|
?? throw new System.Exception($"RefreshMaterializedViewAsync<{typeof(TEntity).Name}>(..) db table for this type does not found.");
|
||||||
|
return RefreshMaterializedViewAsync(materializedViewName, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> RefreshMaterializedViewAsync(string materializedViewName, CancellationToken token = default)
|
public Task<int> RefreshMaterializedViewAsync(string materializedViewName, CancellationToken token)
|
||||||
{
|
{
|
||||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
||||||
return Database.ExecuteSqlRawAsync(sql, token);
|
return Database.ExecuteSqlRawAsync(sql, token);
|
||||||
|
@ -56,8 +56,8 @@ namespace AsbCloudDb.Model
|
|||||||
|
|
||||||
DatabaseFacade Database { get; }
|
DatabaseFacade Database { get; }
|
||||||
|
|
||||||
Task<int> RefreshMaterializedViewAsync(string? mwName = null, CancellationToken token = default);
|
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
||||||
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token = default) where TEntity : class;
|
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;
|
||||||
int SaveChanges();
|
int SaveChanges();
|
||||||
int SaveChanges(bool acceptAllChangesOnSuccess);
|
int SaveChanges(bool acceptAllChangesOnSuccess);
|
||||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
||||||
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Repository
|
namespace AsbCloudInfrastructure.Repository
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CRUD ñåðâèñ ñ êåøåì â îïåðàòèâêå
|
/// CRUD ñåðâèñ ñ êåøåì â îïåðàòèâêå
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Repository
|
namespace AsbCloudInfrastructure.Repository
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CRUD сервис для работы с БД
|
/// CRUD сервис для работы с БД
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -126,7 +126,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
|||||||
var dto = new DailyReportDto()
|
var dto = new DailyReportDto()
|
||||||
{
|
{
|
||||||
ReportDate = date,
|
ReportDate = date,
|
||||||
WellName = well.Caption,
|
WellName = well!.Caption,
|
||||||
ClusterName = well.Cluster,
|
ClusterName = well.Cluster,
|
||||||
};
|
};
|
||||||
DailyReportDto result = dto;
|
DailyReportDto result = dto;
|
||||||
|
@ -12,6 +12,7 @@ using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DetectOperations
|
namespace AsbCloudInfrastructure.Services.DetectOperations
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
public class OperationDetectionBackgroundService : BackgroundService
|
public class OperationDetectionBackgroundService : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly string connectionString;
|
private readonly string connectionString;
|
||||||
@ -116,12 +117,12 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
{
|
{
|
||||||
DateTime = d.DateTime,
|
DateTime = d.DateTime,
|
||||||
IdUser = d.IdUser,
|
IdUser = d.IdUser,
|
||||||
WellDepth = (float)d.WellDepth,
|
WellDepth = d.WellDepth ?? float.NaN,
|
||||||
Pressure = (float)d.Pressure,
|
Pressure = d.Pressure ?? float.NaN,
|
||||||
HookWeight = (float)d.HookWeight,
|
HookWeight = d.HookWeight ?? float.NaN,
|
||||||
BlockPosition = (float)d.BlockPosition,
|
BlockPosition = d.BlockPosition ?? float.NaN,
|
||||||
BitDepth = (float)d.BitDepth,
|
BitDepth = d.BitDepth ?? float.NaN,
|
||||||
RotorSpeed = (float)d.RotorSpeed,
|
RotorSpeed = d.RotorSpeed ?? float.NaN,
|
||||||
})
|
})
|
||||||
.OrderBy(d => d.DateTime);
|
.OrderBy(d => d.DateTime);
|
||||||
|
|
||||||
@ -150,9 +151,9 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < detectors.Length; i++)
|
for (int i = 0; i < detectors.Length; i++)
|
||||||
{
|
{
|
||||||
if (detectors[i].TryDetect(idTelemetry, data, positionBegin, positionEnd, lastDetectedOperation, out OperationDetectorResult result))
|
if (detectors[i].TryDetect(idTelemetry, data, positionBegin, positionEnd, lastDetectedOperation, out OperationDetectorResult? result))
|
||||||
{
|
{
|
||||||
detectedOperations.Add(result.Operation);
|
detectedOperations.Add(result!.Operation);
|
||||||
lastDetectedOperation = result.Operation;
|
lastDetectedOperation = result.Operation;
|
||||||
isDetected = true;
|
isDetected = true;
|
||||||
positionBegin = result.TelemetryEnd;
|
positionBegin = result.TelemetryEnd;
|
||||||
@ -163,7 +164,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isDetected)
|
if (isDetected)
|
||||||
startDate = lastDetectedOperation.DateEnd;
|
startDate = lastDetectedOperation!.DateEnd;
|
||||||
else
|
else
|
||||||
startDate = data[positionEnd].DateTime;
|
startDate = data[positionEnd].DateTime;
|
||||||
}
|
}
|
||||||
@ -171,4 +172,5 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
return detectedOperations;
|
return detectedOperations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.WellOperationService
|
namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
public class WellOperationService : IWellOperationService
|
public class WellOperationService : IWellOperationService
|
||||||
{
|
{
|
||||||
private readonly IAsbCloudDbContext db;
|
private readonly IAsbCloudDbContext db;
|
||||||
@ -219,4 +220,5 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user