eliminates region sections

This commit is contained in:
BinaryAlley committed 2024-10-12 22:03:57 +03:00
1 parent 705c02b90d
commit 405fc1ff9a
370 files changed
+47 -1618

No files matched your search

@@ -11,7 +11,6 @@ namespace Lumina.Infrastructure.Common.DependencyInjection;
/// </summary>
public static class InfrastructureLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Extension method for adding the Infrastructure layer services to the DI container.
/// </summary>
@@ -24,5 +23,4 @@ public static class InfrastructureLayerServices
return services;
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Infrastructure.Common.DependencyInjection;
/// </summary>
public static class SharedConfiguration
{
#region ================================================================== METHODS ===================================================================================
/// <summary>
/// Extension method for registering the shared configuration to the DI container.
/// </summary>
@@ -45,5 +44,4 @@ public static class SharedConfiguration
.ValidateOnStart();
return services;
}
#endregion
}
@@ -11,9 +11,7 @@ public static partial class Errors
{
public static class Configuration
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error ApplicationThemeCannotBeEmpty => Error.Validation(nameof(ApplicationThemeCannotBeEmpty));
public static Error DatabaseConnectionStringCannotBeEmpty => Error.Validation(nameof(DatabaseConnectionStringCannotBeEmpty));
#endregion
}
}
}
@@ -10,14 +10,10 @@ namespace Lumina.Infrastructure.Common.Models.Configuration;
[DebuggerDisplay("{SECTION_NAME}")]
public class CommonSettingsModel
{
#region ================================================================== FIELD MEMBERS ================================================================================
public const string SECTION_NAME = "CommonSettings";
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the theme of the application.
/// </summary>
public required string Theme { get; init; }
#endregion
}
@@ -10,14 +10,10 @@ namespace Lumina.Infrastructure.Common.Models.Configuration;
[DebuggerDisplay("{SECTION_NAME}")]
public class DatabaseSettingsModel
{
#region ================================================================== FIELD MEMBERS ================================================================================
public const string SECTION_NAME = "ConnectionStrings";
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets or sets the connection string to the database.
/// </summary>
public required string DefaultConnection { get; init; }
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Infrastructure.Common.Utilities;
/// </summary>
public static class OptionsBuilderFluentValidationUtilities
{
#region ================================================================== METHODS ===================================================================================
/// <summary>
/// Extension method to add fluent validation to the options validation pipeline.
/// </summary>
@@ -29,5 +28,4 @@ public static class OptionsBuilderFluentValidationUtilities
serviceProvider => new FluentValidationOptions<TOptions>(optionsBuilder.Name, serviceProvider.GetRequiredService<IValidator<TOptions>>()));
return optionsBuilder;
}
#endregion
}
@@ -13,18 +13,13 @@ namespace Lumina.Infrastructure.Common.Validation;
/// <typeparam name="TOptions">The type of options being validated.</typeparam>
public class FluentValidationOptions<TOptions> : IValidateOptions<TOptions> where TOptions : class
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IValidator<TOptions> _validator;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the options being validated.
/// </summary>
public string? Name { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FluentValidationOptions{TOptions}"/> class.
/// </summary>
@@ -35,9 +30,7 @@ public class FluentValidationOptions<TOptions> : IValidateOptions<TOptions> wher
Name = name;
_validator = validator;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Validates the specified <paramref name="options"/>.
/// </summary>
@@ -61,10 +54,9 @@ public class FluentValidationOptions<TOptions> : IValidateOptions<TOptions> wher
// if the validation fails, collect the error messages
// TODO: add translation support for the error messages
string[] errors = validationResult.Errors.Select(x => $"Options validation failed for '{x.PropertyName}' with error: '{x.ErrorMessage}'")
.ToArray();
.ToArray();
// and return them with a failure result
return ValidateOptionsResult.Fail(errors);
}
#endregion
}
}
@@ -10,7 +10,6 @@ namespace Lumina.Infrastructure.Common.Validators;
/// </summary>
public class CommonSettingsModelValidator : AbstractValidator<CommonSettingsModel>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="CommonSettingsModelValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class CommonSettingsModelValidator : AbstractValidator<CommonSettingsMode
{
RuleFor(x => x.Theme).NotEmpty().WithMessage(Errors.Errors.Configuration.ApplicationThemeCannotBeEmpty.Code);
}
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Infrastructure.Common.Validators;
/// </summary>
public class DatabaseSettingsModelValidator : AbstractValidator<DatabaseSettingsModel>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseSettingsModelValidator"/> class.
/// </summary>
@@ -18,5 +17,4 @@ public class DatabaseSettingsModelValidator : AbstractValidator<DatabaseSettings
{
RuleFor(x => x.DefaultConnection).NotEmpty().WithMessage(Errors.Errors.Configuration.DatabaseConnectionStringCannotBeEmpty.Code);
}
#endregion
}