nhibernate - 加载 NHibernate 依赖的 dll 之一时出错

标签 nhibernate nuget castle

我正在使用 NHibernate 构建应用程序。因为我无法添加当前 NHibernate 版本的 DLL(当框架 4.0 是目标时,我无法添加引用)。

我试图获得最新和最好的 w.w.w.,这就是我现在所拥有的:

  • NHibernate.dll (3.2.0.4000)
  • NHibernate.ByteCode.CaSTLe (3.0.0.4000)
  • FluentNHibernate.dll (1.2.0.694)
  • 城堡核心 (2.5.2.0)
  • CaSTLe.Services.Logging.NLogIntegration (2.5.2.0)
  • Antlr.Runtim (3.1.3.42154)
  • Iesi.Collections (3.2.0.400)

  • 这些我可以引用和构建我的解决方案。我知道复制/加载 dll.s 存在一些问题,因此我将它们设为部署项。
    但是运行时我(仍然)得到以下信息:

    NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.



    解决方案:

    确认您的部署文件夹包含以下程序集之一:

    NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.TypeLoadException: Method 'IsProxy' in type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory' from assembly 'NHibernate.ByteCode.Castle, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.



    有人想吗?

    针对 Vijay Gill 的回答,我决定采取不同的策略。

    NUGet 软件包、一站式商店和轻松更新!

    那里有一个 FluentNHibernate 包。我已经安装了它,但我想这里也有一些问题:

    测试方法 CoreDatabaseTests.CreateCoreDatabase 抛出异常:

    System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

    最佳答案

    使用 NHibernate 3.2,您不再需要 NHibernate.ByteCode.CaSTLe,这大大简化了您的依赖树。

    关于nhibernate - 加载 NHibernate 依赖的 dll 之一时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6911792/

    相关文章:

    asp.net-mvc - 如何验证自定义属性?

    c# - 如何创建一个 nuget 包,将文件复制到消费者的构建输出

    visual-studio - VS2017 缺少“管理 NuGet 包”对话框

    c# - nuget-packing a csproj 与 nuspec 之间的区别

    NHibernate 组件继承

    c# - 无法使用 NHibernate 加入分布式事务

    c# - 关于多对多关系的OO问题(NHibernate的规划)

    .net - 温莎城堡 transient 一次性用品

    c# - 用于 log4net 的 CaSTLe 日志记录工具,具有流畅的 log4net 配置

    .net - .NET 中的 CastLe AOP 实现