使用Fluent验证配置NancyFx

Emi*_*ian 10 configuration fluentvalidation nancy

我是否需要在应用程序Bootstrapper中添加任何配置代码以在Nancy中启用FluentValidation?

按照https://github.com/NancyFx/Nancy/tree/master/src/Nancy.Demo.Validation中的示例,我尝试在模型上使用this.Validate时收到以下异常消息:无法找到模型验证工厂.

我正在使用Nancy版本0.11.0.0

The*_*kie 9

您使用的是Bootstrapper软件包(autofac,ninject,unity,windsor,structuremap)吗?如果您需要从引导程序类型继承,请重写ConfigureApplicationContainer并在容器中注册该类型.如果您使用默认的引导程序,那么它应该自行连接

在下一个版本0.12中,无论您使用什么引导程序,它都会自动连接

  • 是的单身人士很好.南希被设计成无国籍 (3认同)