无法加载类型'NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu' [英] Unable to load type 'NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu'

查看:111
本文介绍了无法加载类型'NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过"您的第一个基于NHibernate的应用程序"来了解其他类型的ORM(我习惯于DevExpress的XPO),并且我了解到tut使用的版本和最新的可用版本之间存在差异. >

当我尝试运行can_add_new_product测试时,出现标题为该问题的错误.

  1. 我已经添加了对NHibernate.ByteCode.LinFu(CopyLocal = true)的引用
  2. 我像这样将属性添加到hibernate.cfg.xml中(为了可读起见,以多行隔开):

    NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu

并且我确保我正在x86中运行该构建.

我还能怎么做解决这个问题?

解决方案

节点中的完整语法应如下所示:

<property name="proxyfactory.factory_class">
   NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
</property>

您可以验证这是您的全文吗?另外,请确保使用DLL拥有以下内容:

LinFu.DynamicProxy.dll
NHibernate.ByteCode.LinFu.dll

希望这会有所帮助.我使用它进行延迟加载,它可以与2.1.0GA分支一起成功使用(即使我们的分支从主干中有一些向后移植的修复程序(SqlServerCE问题)

更新1

好吧,在我的项目中,我引用了以下程序集:

  • Antlr3.Runtime.dll
  • Iesi.Collections.dll
  • LinFu.DynamicProxy.dll
  • log4net.dll
  • NHibernate.byteCode.LinFu.dll
  • NHibernate.dll

您还可以发布完整的hibernate.cfg.xml(NHibernate配置文件)吗?

更新2

您是否启用了log4net输出?我发现最简单的方法是通过代码.尝试在代码中执行类似的操作,以便获得一些高级日志记录:

FileAppender appender = new FileAppender();

appender.File = "nhibernate.log";
appender.LockingModel = new FileAppender.MinimalLock();
appender.ImmediateFlush = true;

pattern = "%timestamp, %thread, %level, %logger, %ndc,%message %newline";
PatternLayout pl = new PatternLayout(pattern);

appender.Layout = pl;
appender.ActivateOptions();
appender.Threshold = log4net.Core.Level.Verbose;

log4net.Config.BasicConfigurator.Configure(appender);

使用此输出,我们也许可以进一步找到问题的原因.

很高兴获得您的项目的副本,以便我们调查并帮助您找到错误的原因.

更新3

好吧,我按照教程学习了,这些是我的笔记,我能够得到一个正在运行的示例,直到更新实现为止:

  • 向FirstSolution/Domain/Product.cs添加了虚拟子句
  • 将LinFu.DynamicProxy和NHibernate.ByteCode.LinFu程序集添加到FirstSolution File
  • 将NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu添加到配置文件中
  • 更改了新的SchemaExport(cfg).Execute(false,true,false,false);到新的SchemaExport(cfg).Execute(false,true,false);

I'm trying to work through the "Your first NHibernate based application" to get the hang of other types of ORMs (I'm used to DevExpress' XPO) and I understand that there is a difference between the version that the tut uses and the newest available version.

When I try to run the can_add_new_product test I get the error that titles this question.

  1. I've added a reference to NHibernate.ByteCode.LinFu (CopyLocal=true)
  2. I added the property to my hibernate.cfg.xml like so (spaced to multiple lines for readability):

    NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu

And I made sure that I'm running the build in x86.

What else can I do to solve this?

解决方案

The full syntax in the node should be like this:

<property name="proxyfactory.factory_class">
   NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
</property>

Can you verify this is your entire text? Also make sure that with your DLL's you have the following:

LinFu.DynamicProxy.dll
NHibernate.ByteCode.LinFu.dll

Hope this helps. I use this for lazy loading and it works successfully with the 2.1.0GA branch (even though our branch has some backported fixes from the trunk (SqlServerCE issues)

Update 1

Ok, in my projects I reference the following assemblies:

  • Antlr3.Runtime.dll
  • Iesi.Collections.dll
  • LinFu.DynamicProxy.dll
  • log4net.dll
  • NHibernate.byteCode.LinFu.dll
  • NHibernate.dll

Can you also post your full hibernate.cfg.xml, the NHibernate configuration file?

Update 2

Have you enabled log4net output? I found that the easiest way to do that was from code. Try doing something like this in your code so you can get some advanced logging:

FileAppender appender = new FileAppender();

appender.File = "nhibernate.log";
appender.LockingModel = new FileAppender.MinimalLock();
appender.ImmediateFlush = true;

pattern = "%timestamp, %thread, %level, %logger, %ndc,%message %newline";
PatternLayout pl = new PatternLayout(pattern);

appender.Layout = pl;
appender.ActivateOptions();
appender.Threshold = log4net.Core.Level.Verbose;

log4net.Config.BasicConfigurator.Configure(appender);

With this output we maybe able to further find what the cause of the issue is.

Would be nice to get a copy of your project so I can investigate and help you find the reason for your errors.

Update 3

Ok, I followed the tutorial and these are my notes and I was able to get a running example up to the update implementation:

  • Added virtual clause to FirstSolution/Domain/Product.cs
  • Added LinFu.DynamicProxy and NHibernate.ByteCode.LinFu assemblies to FirstSolution File
  • Added NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu to the configuration file
  • Changed new SchemaExport(cfg).Execute(false, true, false, false); to new SchemaExport(cfg).Execute(false, true, false);

这篇关于无法加载类型'NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆