I have a webapi where I want to validate if the used parameter is of type int
. I know of the attribute DataTypesAttribute
but it doesn't support the simple types. I do not want to create a custom attribute for this.
Take a look at here , as mentioned when you desalinize from a json
string to object the value type must be int
, if not the desalinization will fail. model validation as it's name suggests is mostly for domain driven and business related validations not type specific.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.