How do I get a property's original value while validating, in EF Core?

纵饮孤独 提交于 2020-01-07 05:16:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!