I found the solution. The method below will execute for each property in the current model. I am able to apply some logic and determine if I want to add my custom "ConditionallyRequired" Data Annotation to the property.
public class CustomMetadataValidationProvider : DataAnnotationsModelValidatorProvider
{
protected override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes)
{
var validators = PermissionManager.Settings.Validation.ToList();
var validateField =
validators.SingleOrDefault(v => v.FieldName == metadata.PropertyName && v.IsValidated == "True");
var attr = new List<Attribute>();
attr.AddRange(attributes);
if (validateField != null)
{
attr.Add(new ConditionallyRequired(validateField.FieldName));
}
return base.GetValidators(metadata, context, attr);
}
}
Then initialize the CustomMetadataValidationProvider class in the global.asax like so:
protected void Application_Start()
{
ModelValidatorProviders.Providers.Add(new ConditionallyRequired.CustomMetadataValidationProvider());
AreaRegistration.RegisterAllAreas();
}