diff --git a/Persistence.API/DependencyInjection.cs b/Persistence.API/DependencyInjection.cs index c97f4e0..123e20a 100644 --- a/Persistence.API/DependencyInjection.cs +++ b/Persistence.API/DependencyInjection.cs @@ -100,7 +100,7 @@ public static class DependencyInjection { OnMessageReceived = context => { - var accessToken = context.Request.Headers["Authorization"] + var accessToken = context.Request.Headers.Authorization .ToString() .Replace(JwtBearerDefaults.AuthenticationScheme, string.Empty) .Trim(); diff --git a/Persistence.API/Extensions.cs b/Persistence.API/Extensions.cs index a429915..5fa9fd4 100644 --- a/Persistence.API/Extensions.cs +++ b/Persistence.API/Extensions.cs @@ -8,16 +8,14 @@ public static class Extensions public static T GetUserId(this ClaimsPrincipal principal) { ArgumentNullException.ThrowIfNull(principal, nameof(principal)); - + var loggedInUserId = principal.FindFirstValue(ClaimTypes.NameIdentifier); - if (String.IsNullOrEmpty(loggedInUserId)) - throw new ArgumentNullException(nameof(loggedInUserId)); + ArgumentNullException.ThrowIfNullOrEmpty(loggedInUserId, nameof(loggedInUserId)); var result = TypeDescriptor.GetConverter(typeof(T)).ConvertFromInvariantString(loggedInUserId); - if (result is null) - throw new ArgumentNullException(nameof(result)); + ArgumentNullException.ThrowIfNull(result, nameof(result)); return (T)result; diff --git a/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs b/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs index ea6fccf..fac75d8 100644 --- a/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs +++ b/Persistence.Database.Postgres/Migrations/20241118052225_SetpointMigration.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs b/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs index dfa9396..22d31f0 100644 --- a/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs +++ b/Persistence.Database.Postgres/Migrations/20241122074646_InitialCreate.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs b/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs index 0802b00..4750bc3 100644 --- a/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs +++ b/Persistence.Database.Postgres/Migrations/20241126071115_Add_ChangeLog.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs b/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs index ccf18d4..41ef8cb 100644 --- a/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs +++ b/Persistence.Database.Postgres/Migrations/20241202072250_TechMessageMigration.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/Persistence.Repository/Extensions/EFExtensionsSortBy.cs b/Persistence.Repository/Extensions/EFExtensionsSortBy.cs index a716f43..398a3ed 100644 --- a/Persistence.Repository/Extensions/EFExtensionsSortBy.cs +++ b/Persistence.Repository/Extensions/EFExtensionsSortBy.cs @@ -44,7 +44,7 @@ public static class EFExtensionsSortBy var name = propertyInfo.Name.ToLower(); ParameterExpression arg = Expression.Parameter(type, "x"); MemberExpression property = Expression.Property(arg, propertyInfo.Name); - var selector = Expression.Lambda(property, [ arg ]); + var selector = Expression.Lambda(property, [arg]); var typeAccessor = new TypeAccessor { KeySelector = selector, @@ -200,7 +200,7 @@ public static class EFExtensionsSortBy : orderByAscending; var newQuery = (IOrderedQueryable)genericMethod - .Invoke(genericMethod, new object[] { query, lambdaExpression })!; + .Invoke(genericMethod, [query, lambdaExpression])!; return newQuery; } diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 6b9dd1e..aecb62c 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -195,7 +195,7 @@ public class ChangeLogRepository : IChangeLogRepository return datesOnly; } - private ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) + private static ChangeLog CreateEntityFromDto(Guid idAuthor, Guid idDiscriminator, DataWithWellDepthAndSectionDto dto) { var entity = new ChangeLog() { diff --git a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs index c9814b1..2690c09 100644 --- a/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs +++ b/Persistence.Repository/Repositories/TimeSeriesDataCachedRepository.cs @@ -34,7 +34,7 @@ public class TimeSeriesDataCachedRepository : TimeSeriesDataRepos public override async Task> GetGtDate(DateTimeOffset dateBegin, CancellationToken token) { - if (LastData.Count() == 0 || LastData[0].Date > dateBegin) + if (LastData.Count == 0 || LastData[0].Date > dateBegin) { var dtos = await base.GetGtDate(dateBegin, token); return dtos; diff --git a/exclusion.dic b/exclusion.dic index 17113fb..9602d51 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -70,8 +70,9 @@ minidisplay oauth sbin прога -Persistance yyyyMMdd_HHmmssfff Serializers keycloak Params +Mapster +dest