включен nullable-enabled для проекта AsbCloudWebApi

This commit is contained in:
Olga Nemt 2023-05-17 12:31:29 +05:00
parent 57d262d85a
commit 08501fee30
7 changed files with 7 additions and 32 deletions

View File

@ -25,7 +25,7 @@ namespace AsbCloudApp.Services
/// <param name="key"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<System.Text.Json.JsonDocument> GetOrDefaultAsync(int userId, string key, CancellationToken token);
Task<System.Text.Json.JsonDocument?> GetOrDefaultAsync(int userId, string key, CancellationToken token);
/// <summary>
/// Добавить или изменить настройки с ключем для пользователя

View File

@ -16,7 +16,7 @@ namespace AsbCloudInfrastructure.Repository
this.context = context;
}
public Task<System.Text.Json.JsonDocument> GetOrDefaultAsync(int userId, string key, CancellationToken token)
public Task<System.Text.Json.JsonDocument?> GetOrDefaultAsync(int userId, string key, CancellationToken token)
=> context.Set<UserSetting>()
.Where(s => s.IdUser == userId && s.Key == key)
.Select(s => s.Value)

View File

@ -6,6 +6,7 @@
<ServerGarbageCollection>true</ServerGarbageCollection>
<NoWarn>$(NoWarn);1591</NoWarn>
<UserSecretsId>80899ceb-210f-4f19-ac56-aa90a5d666d4</UserSecretsId>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -145,7 +145,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
else
{
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
(int)idWell, token).ConfigureAwait(false))
idWell!.Value, token).ConfigureAwait(false))
return Forbid();
idsWells = new List<int> { (int)idWell };
}

View File

@ -19,7 +19,7 @@ namespace AsbCloudWebApi.Middlewares
{
try
{
await next?.Invoke(context);
await next.Invoke(context);
}
catch (ArgumentInvalidException ex)
{

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace AsbCloudWebApi
{
@ -8,7 +9,7 @@ namespace AsbCloudWebApi
{
public static SortedSet<string> Registered { get; } = new SortedSet<string>();
public string Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// Проверка наличия у пользователя разрешения с именем "{ControllerName}.{http_method}".

View File

@ -1,27 +0,0 @@
using System.Diagnostics;
namespace AsbCloudWebApi
{
public class TraceListenerView : TraceListener
{
public TraceListenerView()
{
Trace.Listeners.Add(this);
}
public override void Write(object o)
{
base.Write(o);
}
public override void Write(string message)
{
//throw new NotImplementedException();
}
public override void WriteLine(string message)
{
//throw new NotImplementedException();
}
}
}