问题描述
有没有任何配置代码,我必须添加在应用程序Bootstrapper中,以启用FluentValidation在Nancy?
Is there any configuration code that I have to add in the application Bootstrapper to enable FluentValidation in Nancy?
按照 I在尝试在模型上使用this.Validate时收到以下异常消息:找不到模型验证工厂。
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.
我正在使用Nancy您是否正在使用Bootstrapper软件包(autofac,ninject,unity,windsor,structuremap)中的一个?
I'm using Nancy version 0.11.0.0
推荐答案
如果您需要从引导程序类型继承,请覆盖ConfigureApplicationContainer并在容器中注册类型。如果你使用默认的引导程序,那么它应该自己连线
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
在下一个版本中,0.12,无论你使用什么引导程序,它都会自动连接
With out next release, 0.12, it will wired up automatically no matter what bootstrapper you are using
这篇关于使用Fluent验证配置NancyFx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!