Fluentnhibernate 和 nhibernate 验证器版本错误

发布于 2024-08-24 21:41:14 字数 306 浏览 4 评论 0 原文

我们有一个使用 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

始终不够爱げ你 2024-08-31 21:41:14

1)重新编译是一个选项,这将允许您使用这两个而不会出现汇编问题。

2) 另一种是程序集绑定重定向,任何对 NHibernate 早期版本的调用都可以强制转到您拥有的版本。您可以使用 app.conifg / web.conifg 执行此操作

(您可以找到有关它的更多信息 此处

<configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
                <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4"/>
                <bindingRedirect oldVersion="2.1.0.4000" newVersion="2.1.2.4000"/>
             </dependentAssembly>
          </assemblyBinding>
       </runtime>
</configuration>

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)

<configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
                <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4"/>
                <bindingRedirect oldVersion="2.1.0.4000" newVersion="2.1.2.4000"/>
             </dependentAssembly>
          </assemblyBinding>
       </runtime>
</configuration>
温柔女人霸气范 2024-08-31 21:41:14

并不是说它会解决您的问题,而是您是否考虑过 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.

热血少△年 2024-08-31 21:41:14

最新版本 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文