NHibernate1.2 MySqlデータベースへの接続の問題

1255 ワード

「呼び出し先に異常が発生しました」というヒントを得て、半日探して、文章の中で
NHibernate 1.2 Migrationで見つけた
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=..."/>

それで見つけたData.dllは、ユニットテストのディレクトリにコピーされ、上のエラーメッセージがなくなりました.