Validating an object not received during a request(FluentValidation) [Answered]
Hi, I'm trying to achieve this: I receive Id and someRequest model from an endpoint(separate ID because I'm trying to comply to REST standards and don't want to cram [FromRoute] into the request model]. I also have a different someCommand model,the takes aforementioned id and model into the constructor and creates an object that will be queried against database)This model has validation using
AbstractValidation<T>
class of FluentValidation. I'm wondering, would these validators even work, considering I'm not receiving this model from the request?4 Replies
You can manually run the validation just fine
also, FluentValidation recommends against using the "automatic validation" style: https://docs.fluentvalidation.net/en/latest/aspnet.html
so yeah, you can use manual validation when/whereever you want
Thanks! Didn't even know that bit about automatic validation!
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
✅ This post has been marked as answered!