I have a controller method with array of integers input, which must not be null or more than 10 elements size. To validate input I 've made a class:
public class TestForm
{
[Required]
[MaxLength(10)]
public long[] feedIds { get; set; }
}
And controller method:
[HttpPost]
public async Task<IActionResult> DoSomeJob(TestForm form)
{
//Do some job
}
According to MSDN, System.ComponentModel.DataAnnotations.MaxLength can be used for array, but there is no validation, it gets null and array of any size. What am I doing wrong?