I'm trying to override the default message of the SetAttemptedValueIsInvalidAccessor(Func<String,String,String>) in the startup.cs
The default message,
services.AddMvcCore().AddMvcOptions(opt =>
{
opt.ModelBindingMessageProvider.SetAttemptedValueIsInvalidAccessor(x,y) => $"The value {y} is not valid for {x}."
}
Is there a way I could override this message to include range ?
services.AddMvcCore().AddMvcOptions(opt =>
{
opt.ModelBindingMessageProvider.SetAttemptedValueIsInvalidAccessor(x,y) => $"The value for {y} must be between {range1} and {range2}."
}
I tried writing a custom attribute. However that won't be triggered unless if there a way to suppress only this model validation.