System.ComponentModel.DataAnnotations を使用するいくつかのカスタム検証メソッドを設定しようとしています。検証に使用する一般的なメソッドをいくつか作成しました。問題が発生する場所は次のとおりです。
private void SetValidationAttributeErrors<TEntity>(TEntity item, List<string> errors)
{
var result = from prop in TypeDescriptor.GetProperties(item).Cast<PropertyDescriptor>()
from attribute in prop.Attributes.OfType<ValidationAttribute>()
where !attribute.IsValid(prop.GetValue(item))
select attribute.FormatErrorMessage(string.Empty);
}
「ValidationAttribute」タイプに、見つからないというエラーがあります。DataAnnotations の using ステートメントがあります。何か案は?