Skip to content

Commit e5a39ae

Browse files
committed
Delete Invariant methods and change to Ordinal for optimization.
1 parent c28ecba commit e5a39ae

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

Ecommerce/src/Modules/Orders/Ecommerce.Modules.Orders.Application/Orders/Features/Orders/ChangeStatus/ChangeStatusValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ChangeStatusValidator()
2121
.NotNull()
2222
.Custom((value, context) =>
2323
{
24-
if (!_availableStatuses.Contains(value, StringComparer.InvariantCultureIgnoreCase))
24+
if (!_availableStatuses.Contains(value, StringComparer.OrdinalIgnoreCase))
2525
{
2626
context.AddFailure($"Provided status is invalid. Please use the following ones: {string.Join(", ", _availableStatuses)}.");
2727
}

Ecommerce/src/Modules/Orders/Ecommerce.Modules.Orders.Application/Returns/Features/Returns/SetReturnProductStatus/SetReturnProductStatusValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public SetReturnProductStatusValidator()
2525
.NotNull()
2626
.Custom((value, context) =>
2727
{
28-
if (!_availableStatuses.Contains(value, StringComparer.InvariantCultureIgnoreCase))
28+
if (!_availableStatuses.Contains(value, StringComparer.OrdinalIgnoreCase))
2929
{
3030
context.AddFailure($"Provided status is invalid. Please use the following ones: {string.Join(", ", _availableStatuses)}.");
3131
}

Ecommerce/src/Modules/Orders/Ecommerce.Modules.Orders.Infrastructure/Delivery/DeliveryServiceFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public DeliveryServiceFactory(IServiceProvider serviceProvider)
1919

2020
public IDeliveryService GetDeliveryService(string shippingService)
2121
{
22-
return shippingService.ToUpperInvariant() switch
22+
return shippingService.ToUpper() switch
2323
{
2424
"INPOST" => _serviceProvider.GetRequiredService<InpostService>(),
2525
"DPD" => _serviceProvider.GetRequiredService<DPDService>(),

Ecommerce/src/Modules/Users/Ecommerce.Modules.Users.Core/Services/EmployeeService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task<PagedResult<EmployeeBrowseDto>> BrowseAsync(SieveModel model,
4141

4242
public async Task<Guid> CreateAsync(EmployeeCreateDto dto, CancellationToken cancellationToken = default)
4343
{
44-
var email = dto.Email.ToLowerInvariant();
44+
var email = dto.Email.ToLower();
4545
if (await _userRepository.GetByEmailAsync(email, cancellationToken) is not null)
4646
{
4747
throw new EmailInUseException();

Ecommerce/src/Modules/Users/Ecommerce.Modules.Users.Core/Services/IdentityService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public async Task<JsonWebToken> SignInAsync(SignInDto dto, CancellationToken can
8585
}
8686
public async Task SignUpAsync(SignUpDto dto, CancellationToken cancellationToken = default)
8787
{
88-
var email = dto.Email.ToLowerInvariant();
88+
var email = dto.Email.ToLower();
8989
if(await _userRepository.GetByEmailAsync(email, cancellationToken) is not null)
9090
{
9191
throw new EmailInUseException();

Ecommerce/src/Shared/Ecommerce.Shared.Infrastructure/Auth/AuthManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public ClaimsPrincipal GetPrincipalFromExpiredToken(string token)
8585
SecurityToken securityToken;
8686
var principal = tokenHandler.ValidateToken(token, tokenValidationParameters, out securityToken);
8787
var jwtSecurityToken = securityToken as JwtSecurityToken;
88-
if (jwtSecurityToken == null || !jwtSecurityToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256, StringComparison.InvariantCultureIgnoreCase))
88+
if (jwtSecurityToken == null || !jwtSecurityToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256, StringComparison.OrdinalIgnoreCase))
8989
throw new SecurityTokenException("Invalid token");
9090
return principal;
9191
}

0 commit comments

Comments
 (0)