原文:http://www.darkside.co.za/archive/2009/05/25/configuring-castle-activerecord-2.aspx
最近按照李会军老师的ActiveRecord系列教程学习ActiveRecord的使用。发现一直在报一个错误 :
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
以下是我的翻译:
如果你要下载Castle ActiveRecord 2 Alpha 版本来看一看它又扩展了哪些工程,你就很有可能得到一个错误“The ProxyFactoryFactory was not configured.Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.”因为这次发布的新版本使用了Nhibernate version2.1.0.1003,工想正常工作的你得在配置里加入的信息,要像下面那样,(第十三行是新加的)
1 <activerecord
2 isWeb="false"
3 isDebug="true"
4 threadinfotype=""
5 sessionfactoryholdertype=""
6 namingstrategytype="">
7 <config>
8 <add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
9 <add key="dialect" value="NHibernate.Dialect.MsSql2005Dialect"/>
10 <add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
11 <add key="connection.connection_string" value="Server=(local);initial catalog=AppTest; Integrated Security=SSPI"/>
12 <add key="show_sql" value="true"/>
13 <add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" />
14 </config>
15 </activerecord>