Adds strongly typed IOptions<T> binding, with Fluent Validation and shared appsettings for the Web client app

This commit is contained in:
BinaryAlley committed 2024-09-07 17:11:53 +03:00
1 parent cf7981aad4
commit d8c64920dc
6 files changed
+153 -1

No files matched your search

@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using FluentValidation;
using Lumina.Presentation.Web.Common.Models.Configuration;
#endregion
namespace Lumina.Presentation.Web.Common.Validators;
/// <summary>
/// Validates the needed validation rules for the ServerConfiguration application configuration settings section.
/// </summary>
public class ServerConfigurationModelValidator : AbstractValidator<ServerConfigurationModel>
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfigurationModelValidator"/> class.
/// </summary>
public ServerConfigurationModelValidator()
{
RuleFor(x => x.BaseAddress).NotEmpty().WithMessage("Base address cannot be empty!");
RuleFor(x => x.Port).InclusiveBetween((ushort)0, (ushort)65535).WithMessage("Port number must be between 0 and 65535!");
}
#endregion
}