我正在使用 NHibernate 构建应用程序。因为我无法添加当前 NHibernate 版本的 DLL(当框架 4.0 是目标时,我无法添加引用)。
我试图获得最新和最好的 w.w.w.,这就是我现在所拥有的:
这些我可以引用和构建我的解决方案。我知道复制/加载 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/