C
C#8mo ago
Lounder

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
Lounder
LounderOP8mo ago
Please ping @ me
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Lounder
LounderOP8mo ago
@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
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server