Is there any configuration code that I have to add in the application Bootstrapper to enable FluentValidation in Nancy?
Following the example from https://github.com/NancyFx/Nancy/tree/master/src/Nancy.Demo.Validation I receive the following exception message when trying to use this.Validate on model: No model validator factory could be located.
I'm using Nancy version 0.11.0.0
FluentValidation is a .NET library for building strongly-typed validation rules. It Uses a fluent interface and lambda expressions for building validation rules. It helps clean up your domain code and make it more cohesive, as well as giving you a single place to look for validation logic.
FluentValidation provides a great alternative to Data Annotations in order to validate models. It gives better control of validation rules and makes validation rules easy to read, easy to test, and enable great separation of concerns.
FluentValidation is developed for free by @JeremySkinner in his spare time and financial sponsorship helps keep the project going. Please sponsor the project via either GitHub sponsors or OpenCollective.
Are you using one of the Bootstrapper packages (autofac, ninject, unity, windsor, structuremap)? If you are then you need to inherit from the bootstrapper type, override ConfigureApplicationContainer and register the type in the container. If you are using the default bootstrapper then it should wire itself up
With out next release, 0.12, it will wired up automatically no matter what bootstrapper you are using
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With