forked from ddrilling/AsbCloudServer
nullable enable (часть 4)
This commit is contained in:
parent
cb9e8dd672
commit
b61808e062
@ -8,6 +8,7 @@ using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure
|
||||
{
|
||||
#nullable enable
|
||||
public class ReportDataSourcePgCloud : IReportDataSource
|
||||
{
|
||||
private readonly IAsbCloudDbContext context;
|
||||
@ -37,6 +38,9 @@ namespace AsbCloudInfrastructure
|
||||
.Include(w => w.Telemetry)
|
||||
.FirstOrDefault(w => w.Id == idWell);
|
||||
|
||||
if(well is null)
|
||||
throw new ArgumentInvalidException("idWell doesn`t exist", nameof(idWell));
|
||||
|
||||
idTelemetry = well?.IdTelemetry;
|
||||
if (idTelemetry is null)
|
||||
throw new ArgumentInvalidException($"Well {idWell} doesn't contain telemetry", nameof(idWell));
|
||||
@ -49,7 +53,7 @@ namespace AsbCloudInfrastructure
|
||||
.Where(u => u.IdTelemetry == idTelemetry)
|
||||
.ToDictionary(u => u.IdUser, u => u);
|
||||
|
||||
timezoneOffset = well?.Telemetry?.Info?.TimeZoneOffsetTotalHours ?? well.Timezone?.Hours ?? 5.0;
|
||||
timezoneOffset = well?.Telemetry?.Info?.TimeZoneOffsetTotalHours ?? well!.Timezone?.Hours ?? 5.0;
|
||||
|
||||
info = new WellInfoReport
|
||||
{
|
||||
@ -155,4 +159,5 @@ namespace AsbCloudInfrastructure
|
||||
public WellInfoReport GetWellInfo()
|
||||
=> info;
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ using AsbCloudInfrastructure.Background;
|
||||
|
||||
namespace AsbCloudInfrastructure
|
||||
{
|
||||
#nullable enable
|
||||
public class Startup
|
||||
{
|
||||
public static void BeforeRunHandler(IHost host)
|
||||
@ -20,7 +21,7 @@ namespace AsbCloudInfrastructure
|
||||
using var scope = host.Services.CreateScope();
|
||||
var provider = scope.ServiceProvider;
|
||||
|
||||
var context = provider.GetService<IAsbCloudDbContext>();
|
||||
var context = provider.GetRequiredService<IAsbCloudDbContext>();
|
||||
context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60));
|
||||
context.Database.Migrate();
|
||||
|
||||
@ -70,4 +71,5 @@ namespace AsbCloudInfrastructure
|
||||
return bytes.ToString("### ### ###");
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user