protected override ValidationResult IsValid()

in Webapp/SDAF/Models/CustomValidators.cs [321:337]


            protected override ValidationResult IsValid(object value, ValidationContext context)
            {
                bool isDefault = (bool)context.ObjectInstance.GetType().GetProperty("IsDefault").GetValue(context.ObjectInstance);
                if (isDefault) return ValidationResult.Success;

                string prefix = (string)value;
                string armId = (string)context.ObjectInstance.GetType().GetProperty(targetProperty).GetValue(context.ObjectInstance);

                if (prefix == null && armId == null)
                {
                    return new ValidationResult($"At least one of {thisProperty} or {targetProperty} must be present.");
                }
                else
                {
                    return ValidationResult.Success;
                }
            }