我们有一个使用 FluentNibernate 来映射实体的项目。现在我需要向这些地图添加一些格式验证。对于 Nullable、Length 等,我们当前正在使用映射。我将 NHibernate Validator 添加到项目中,但收到有关需要 NHibernate 版本 2.1.2.4000 的编译时错误。所以我升级到该版本只是为了得到一个运行时错误,指出它找不到 NHibernate 2.1.0.4000。我可以编写扩展方法来使用 FluentNibernate 进行验证吗?我是否必须使用相同版本的 NHibernate 重新编译两者?首选方法是使用这些的发行版。任何其他设备将不胜感激。
We have a project using FluentNibernate to map the entities. Now I need to add some format validation to these maps. For Nullable, Length and such we are currently using the mappings. I added NHibernate Validator to the project, but received a compile time error about needing NHibernate version 2.1.2.4000. So I upgraded to that version just to get a run-time error stating that it could not find NHibernate 2.1.0.4000. Could I write extension methods to do the validation using FluentNibernate? Do I have to recompile both using the same version of NHibernate? The preferred method would be to use a release of these. Any other device would appreciated.
发布评论
评论(3)
1)重新编译是一个选项,这将允许您使用这两个而不会出现汇编问题。
2) 另一种是程序集绑定重定向,任何对 NHibernate 早期版本的调用都可以强制转到您拥有的版本。您可以使用 app.conifg / web.conifg 执行此操作
(您可以找到有关它的更多信息 此处)
1) Recompiling is an option, this would allow you to use both of these without the assembly problems.
2) Another would be an assembly binding redirect, any calls to an earlier version of NHibernate you can force to go to the version that you have. You can do this with your app.conifg / web.conifg
(you can find more about it here)
并不是说它会解决您的问题,而是您是否考虑过 FluentValidation。不过,听起来您在某处有一个引用,要求使用特定版本的 DLL。
Not that it'll fix your problem, but have you considered FluentValidation. Still, sounds like you've got a reference somewhere that requests a specific version of the DLLs.
最新版本 NHibernate.Validator 1.2.0 CR1 和 FluentNHibernate 1.0.0.632 都是针对 NHibernate 2.1.2.4000 构建的。
要获取最新版本的 FluentNHibernate,请访问 CodeBetter.com 上的构建服务器。
要获取最新版本的 NHibernate.Validator,请访问 nhibernate.info。
The latest versions, NHibernate.Validator 1.2.0 CR1 and FluentNHibernate 1.0.0.632, are both built against NHibernate 2.1.2.4000.
To get the latest version of FluentNHibernate, go to the build server at CodeBetter.com.
To get the latest version of NHibernate.Validator, go to nhibernate.info.