Mike
Mike

Reputation: 5509

Is there a way to completely ignore a property using FluentValidation?

When I try to bind a string ("1,000.00") to a decimal property (x) FluentValidation throws the following error: "The value '1,000.00' is not valid for x." I have a DecimalModelBinder that will handle binding the model but FluentValidation prevents me from getting that far. I could strip the comma before the form is submitted but I would rather not handle this for many different fields. I am looking for a way to tell FluentValidation to completely ignore the property and just trust me :).

Thanks in advance for any thoughts or suggestions!

Upvotes: 0

Views: 1331

Answers (1)

amir gh
amir gh

Reputation: 96

i believe this error does not come from fluentValidaton this error probably generated by MVC modelBinding if your are using MVC as i know fluent validation validating object and you can not create instance of your object and assign string to decimal type. so you should search for problem on your DecimalModelBinder

Upvotes: 2

Related Questions