ASP.NET Core - Database Model and ViewModel Validation
What is the point of writing Validation attributes outside of the EF Core Data Model (for example in the ViewModel), given that the checks are not only valid for the database, but are also triggered when a request is received?
4 Replies
Please ping @ me
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
@TeBeCo Does this mean you need to write the same rules from the DB Model validation to the DTO Validation?
This way the request will get stopped before reaching the database
Example validation attribute: [Range(1, 10)]
@ me for immediate response
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View