0

[MetadataType]クラスの[Remote]属性を使用するとエラーが発生します。次のエラーが発生します。エラー15属性「リモート」はこの宣言タイプでは無効です。'property、indexer'宣言でのみ有効です。

エラーの内容は理解しています。[リモート]が機能しない理由がわかりませんが、他の属性は正常に機能します。

[MetadataType(typeof(StudentRowMeta))]  
public class StudentRow
{
    public string Login { get; set; }
}

public class StudentRowMeta
{
    [Required(ErrorMessage = "Please Enter Login")]
    [StringLength(50, ErrorMessage = "Login can not be more than 50 characters")]
    [Remote("IsLoginAvailable", "Validation")]
    public object Login;
} 
4

1 に答える 1