问题
In EF Core, there is a neat way to perform entity validation using IValidatableObject
.
During validation I have the current value, but I also need access to the original value.
This is the validation method:
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { }
Is there some way to get access to the object's original values as well? I think the key is in ValidationContext
but I'm not sure how.
来源:https://stackoverflow.com/questions/41771376/how-do-i-get-a-propertys-original-value-while-validating-in-ef-core