我在启动程序中设置了以下代码
IDictionary<string, string> properties = new Dictionary<string, string>();
properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
properties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("connection.connection_string", "Data Source=ZEUS;Initial Catalog=mydb;Persist Security Info=True;User ID=sa;Password=xxxxxxxx");
InPlaceConfigurationSource source = new InPlaceConfigurationSource();
source.Add(typeof(ActiveRecordBase), (IDictionary<string, string>) properties);
Assembly asm = Assembly.Load("Repository");
Castle.ActiveRecord.ActiveRecordStarter.Initialize(asm, source);我得到了以下错误:
failed: NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException : Unable to load type 'NNHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
可能的原因是:
我已经读过和读过了,我正在引用所有的程序集,挂牌,我完全不知道下一步该尝试什么。
Castle.ActiveRecord.dll
Castle.DynamicProxy2.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NHibernate.ByteCode.Castle.dll
Castle.Core.dll。
我百分之百肯定装配在垃圾箱里。有人有什么想法吗?
发布于 2010-03-20 18:42:37
当NHibernate.ByteCode.Castle.dll是以不同的目标平台作为项目构建时,就会出现这个问题。若要测试此功能,请将程序目标平台更改为以下一个或多个:
如果其中任何一个解决了您的问题,那么您就知道只需要同步DLL和目标平台。
发布于 2010-05-15 06:13:20
我也有这个问题,我的解决方案是在大会中添加创建会话的代码。
private NHibernate.ByteCode.Castle.ProxyFactoryFactory requiredButNeverUsed;https://stackoverflow.com/questions/2481586
复制相似问题