Files
modernkeepass/ModernKeePass.Application/Database/Queries/OpenDatabase/OpenDatabaseQueryValidator.cs
Geoffroy BONNEVILLE 22072bb2fe Most services are implemented as command/queries
Code cleanup
2020-03-26 19:04:51 +01:00

22 lines
663 B
C#

using FluentValidation;
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
{
public class OpenDatabaseQueryValidator : AbstractValidator<OpenDatabaseQuery>
{
public OpenDatabaseQueryValidator()
{
RuleFor(v => v.FilePath)
.NotNull()
.NotEmpty();
RuleFor(v => v.Password)
.NotNull()
.NotEmpty()
.When(v => string.IsNullOrEmpty(v.KeyFilePath));
RuleFor(v => v.KeyFilePath)
.NotNull()
.NotEmpty()
.When(v => string.IsNullOrEmpty(v.Password));
}
}
}