我使用.net 4.5与NHibernate 3.3.3.4000,我想配置一个nhibernate.config与2会话工厂。 我试图configurate我nhibernate.config这样:与x会话工厂nhibernate配置
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="Configuration">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">Data Source=Configuration.db;Version=3</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="query.substitutions">true=1;false=0</property>
<property name="show_sql">false</property>
<mapping assembly="DataModel"/>
</session-factory>
<session-factory name="Texts">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">Data Source=Texts.db;Version=3</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="query.substitutions">true=1;false=0</property>
<property name="show_sql">false</property>
<mapping assembly="DataModel_Texts"/>
</session-factory>
</hibernate-configuration>
但我得到一个HibernateConfigException的“会话工厂”是无效的:出现 异常解析配置:在命名空间中的元素“休眠配置” 'urn:nhibernate-configuration-2.2'在命名空间'urn:nhibernate-configuration-2.2'中有无效的子元素'session-factory'。
你知道我如何配置2会话工厂的文件?
问候 菲尔
你应该使用NH4和.Net 4.5。 –
这是否真的是您在异常中获得的唯一信息,以及它的所有InnerExceptions(如果有)? –
也许这篇文章可以帮助你:http://www.codeproject.com/Articles/14846/Using-NHibernate-with-Multiple-Databases –