Hi Jeremy,
I have the folowing validator, (the real validator in my project have 20 fields and property validation for each one):
publicclass ContactValidator : AbstractValidator<Contact> { [Inject] IMessageProvider Provider { privateget; set; } public ContactValidator() { RuleFor(x => x.Email) .Must(x => x.Length <= 100).WithMessage(Provider.GetText("Validation_EmailTooLong")) .EmailAddress().WithMessage(Provider.GetText("Validation_InvalidEmail")); } }
The problem there is when the validator is created, there are several calls to Provider.GetText(...). The better way would be call Provider.GetText(...) on demand.
In your last post you says the solution is using IStringSource and manually setting the ErrorMessageSource.
Please can you explain me how that can fit in my code above.
Thanks
Cristhiam