Is there a way to do what this question is doing (Either Or Required Validation) but instead of applying it on the entire class, I only want to apply the validation on two specific fields within the class.
For example
public class FooModel {
[Required]
public string Name { get; set; }
[Required]
public decimal Cost { get; set; }
public int Bar1 { get; set; }
public float Bar2 { get; set; }
}
I only want to constrain Bar1 and Bar2 to be an either/or requirement. They cannot both be null. Is there a way to do this?