ich 4 tha Namespace System.ComponentModel.DataAnnotations in C# zu meinem eigenen Validierung Attribut zu implementieren und es sieht aus wie dieseAngepasste Validierung Attribut mit mehreren Instanzen Problem
[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
}
}
ich will dieses Attribut wie unten
[MyCustomValidator("Name", "Job")]
[MyCustomValidator("Name", "Email")]
[MyCustomValidator("Name", "Job")]
public class Employe {
}
Das Problem ist, dass nur eine Validierung durchgeführt wird. Wie kann ich alle Validierungen durchführen (mit asp.net mvc 2)?