MVC 3 IoC 容器导致客户端和服务器验证问题
我们最近将一个项目升级到 MVC 3 Tools,并发现我们的控制反转容器导致客户端和服务器端的本机 MVC 模型绑定验证出现问题。当我们连接 IoC 时,客户端验证根本无法触发,并且控制器中的“IsValid”测试会不稳定地触发并在不应该的情况下传递数据。
我们能够纠正验证框架的唯一方法是完全禁用 IoC。当问题第一次出现时,我们正在使用 Ninject,但我们也尝试过 StructureMap 和 Unity,并遇到了完全相同的行为。我们认为问题可能出在 IDependencyResolver 本身,但这只是猜测。我们还尝试禁用所有第 3 方工具 (Telerik),但问题似乎仅出现在 IoC 中。
我向社区提出的问题:在 MVC 中使用 IoC 时是否有其他人遇到过验证问题?我将非常感谢有关此问题的任何指导。非常感谢。
We have recently upgraded a project to MVC 3 Tools and discovered that our inversion of control container is causing problems with the native MVC model binding validation on both client- and server-side. When we have the IoC hooked up the client validation fails to fire at all and the "IsValid" test in the controller fires erratically and passes along data when it should not.
The only way we've been able to correct the validation framework is to disable the IoC completely. We were using Ninject when the issue first arose but we've also tried StructureMap and Unity and encountered the exact same behavior. We're thinking the issue may reside in IDependencyResolver itself, but that is just a guess. We've also tried disabling all 3rd party tools (Telerik) but the issue seems to only be in the IoC.
My questions for the community: has anybody else experienced validation problems when using IoC in MVC? I would be most grateful for any guidance on this issue. Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论