'Argument 1:Cannot convert from NetSatis.Entities.interfaces.ientity to fluentvalidation.ivalidationcontext
public static class ValidatorTool
{
public static bool Validate(IValidator validator,IEntity entity)
{
bool result = true;
var validationResult = validator.Validate(entity);
if (!validationResult.IsValid)
{
string message = null;
foreach (var error in validationResult.Errors)
{
message += error.ErrorMessage+System.Environment.NewLine;
}
MessageBox.Show(message);
result = false;
}
return result;
I am trying to use validator tools but one day ago i dont get any errors about this entity thing but now i am taking an error about entity, What should i do in order to not get an error
Solution 1:[1]
This is a change on FluentValidation 9, the code below will work:
var context = new ValidationContext<IEntity>(request);
var validationResult = validator.Validate(context);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
