我甚至在app.config中添加了这个小配置:
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess,
Version=2.112.2.0,
Culture=neutral,
PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
......没有成功。可能有什么不对? 另外,为了确保我的app.config是风水,这里是:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="connection.driver_class">
NHibernate.Driver.OracleDataClientDriver
</property>
<property name="connection.connection_string_name">
GuitarStore2
</property>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
</session-factory>
</hibernate-configuration>
<connectionStrings>
<add name="GuitarStore"
connectionString="****************"/>
<add name="GuitarStore2"
connectionString="****************"/>
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess,
Version=2.112.2.0,
Culture=neutral,
PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
</runtime>
</configuration>
为了记录,我在Windows 7 64位下使用最新的Nhibernate(3.3.1),在.NET 3.5上。而且,对于完全相同的项目,我在另一台机器上遇到没有例外,但是在Windows XP中没有例外。
答案 0 :(得分:6)
问题不在于NHibernate,而是IL正在使用32位版本的ODP生成64位代码,因此只需将“Any CPU”选项更改为“x86”,我就摆脱了例外。