✅ Difference between [DataType(DataType.EmailAddress)] and [EmailAddress] data annotations?
Can anyone let me know what's the difference between [DataType(DataType.EmailAddress)] and [EmailAddress] data annotations? Using the former alone is not validating the email field so what's it's purpose? Thanks
4 Replies
the former is mainly for formatting purposes and will not trigger server side validation
only
[EmailAddress]
will trigger server side model validationcould you pls elaborate what do you mean by formatting?
got it, it affects the format displayed in swagger ui
Closed!