NHibernate1.2中连接MySql数据库问题
提示“调用目标发生异常”,找了半天,在文章NHibernate 1.2 Migration
找到了这么一段
于是找到MySql.Data.dll,并拷贝到单元测试的目录下,上面的错误提示没了。
找到了这么一段
Changes in ADO.NET provider assembly loading
NHibernate 1.2 now uses Assembly.Load() instead of Assembly.LoadWithPartialName() to load driver assemblies. This means that it will no longer look for the highest-versioned assembly in the Global Assembly Cache (GAC), which was sometimes undesirable. Instead, it is now your responsibility to either put the provider assembly into the application directory, or add a qualifyAssembly element to the application configuration file, specifying the full name of the assembly.
For example, if you are using MySQL Connector/.NET, you should either put MySql.Data.dll into the application directory (or some other directory from where Assembly.Load() can pick it up), or put it in the GAC and add a qualifyAssembly element to the configuration file:
<qualifyAssembly partialName="MySql.Data" fullName="MySql.Data, Version=..., PublicKeyToken=..."/>
于是找到MySql.Data.dll,并拷贝到单元测试的目录下,上面的错误提示没了。