Where do I find object to compare in CompareValidatorAdapter for Nancy?

谁都会走 提交于 2019-12-13 18:07:08

问题


I want to build a CompareValidatorAdapter for Nancy. Can any one give me some pointers as to where I can get the value to be compared?

public override IEnumerable<ModelValidationRule> GetRules(ValidationAttribute attribute, PropertyDescriptor descriptor)
{
    var ca = (CompareAttribute)attribute;

    yield return new ComparisonValidationRule(attribute.FormatErrorMessage,
        new[] { descriptor.Name },
        ComparisonOperator.Equal, <WHERE DO I GET THIS VALUE?>);
}

Should I use some sort of reflection technique? I have the feeling I am missing something obvious.

来源:https://stackoverflow.com/questions/24576299/where-do-i-find-object-to-compare-in-comparevalidatoradapter-for-nancy

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