public class SomeThingSomething
{
public string Name { get; set; } = "";
public Dictionary<SomeEnum, SomeDetail> SomeDict { get; set; } = new();
}
public class SomeDetail
{
public string Name { get; set; } = "";
public string Surname { get; set; } = "";
}
public class SomeThingSomethingValidator : AbstractValidator<SomeThingSomething>
{
public SomeThingSomethingValidator()
{
RuleFor(md => md.Name).NotNull().NotEmpty();
// Can't get this to work...
RuleForEach(m => m.SomeDict)
}
}
public class SomeDetailValidator : AbstractValidator<SomeDetail>
{
public SomeDetailValidator()
{
RuleFor(md => md.Name).NotNull().NotEmpty();
RuleFor(md => md.Surname).NotNull().NotEmpty();
}
}
Created
May 18, 2023 07:26
-
-
Save roughiain/38bb06ec8bd84390b8d9c358de743878 to your computer and use it in GitHub Desktop.
SampleModels for issue with dictionary and fluent variation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment