Validation custom attribute with multiple instance problem

I am using the System.ComponentModel.DataAnnotations namespace in C # 4 to implement my own validation attribute, and it looks like

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class MyCustomValidator : ValidationAttribute {
    private String Property1 { get; set; }
    private String Property2 { get; set; }

    public ValeTaxiSituacaoRequired(String property1, String property2) {
        Property1 = property1;
        Property2 = property2;
    }

    public override bool IsValid(object value) {
        //validation logic
    }

}

I want to use this attribute below

[MyCustomValidator("Name", "Job")]
[MyCustomValidator("Name", "Email")]
[MyCustomValidator("Name", "Job")]
public class Employe {
}

The problem is that only one check is performed. How can I do all the checks (using asp.net mvc 2)?

+5
source share
3 answers

AllowMultiple = true , TypeID, JQuery

+3
0

All Articles