Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Commented Unassigned: Customizing all the error message with error code [7199]

$
0
0
Hats off. It is a great framework. I used it lot of time in my project. For my new project i have to pass error code and and customize all the error message.
For example i have to generate error code 1201 for NotEmpty validation with our own validation message.
I am wondering is there are a way i can pass the resource file to the framework. So the framework picks up my message instead of default message.

For example instead of
'{PropertyName}' must not be empty.

i will add
Error Code 1201. {Property} must be populated.


I really don't want to add WithMessage all the time.


Comments: Yep - you can specify your own ResourceProviderType: [https://fluentvalidation.codeplex.com/wikipage?title=Localization&referringTitle=Documentation](https://fluentvalidation.codeplex.com/wikipage?title=Localization&referringTitle=Documentation) The provider type should declare 1 property for each default resource name.

Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>