私はFluent NHibernate(NHibernateフレーバーであれば)のプロジェクトを試しています。私は、私は次の例外にして実行しているように、セッションファクトリオブジェクトを作成する点を乗り越えることができなかっました:Fluent NHibernateがSQLCEを使用してセッションファクトリを作成できません
InnerException: NHibernate.HibernateException
Message=The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not be found. Ensure that the assembly System.Data.SqlServerCe is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
Source=NHibernate
StackTrace:
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SqlServerCeDriver..ctor()
InnerException:
私は、最新のFluentNHibernateバイナリを使用しています。 VS 2010、ウィンドウ7 x64上。私はSystem.Data.SqlServerCeアセンブリを "Copy Local"に設定して、プロジェクトのターゲットプラットフォームをx86に変更しました。
流暢な設定は次のとおりです。
var config = Fluently.Configure()
.Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(cnxString))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SyncContract>());
if (!File.Exists(dbPath))
{
var engine = new System.Data.SqlServerCe.SqlCeEngine(cnxString);
engine.CreateDatabase();
config.ExposeConfiguration(c => new SchemaExport(c).Create(false, true));
}
return config;
注:engine.CreateDatabase()が正常に動作します。
お願い/ご意見はありますか?
私は、このプロジェクトをx86に移行する必要はありませんでした。私は "任意のCPU"にターゲットを絞って実行するコードを取得することができました – Sameera
私は同じ問題を実行しました。 TFS上で実行されているテストでは、 "ローカルコピー"が動作しませんでした。私は[テスト設定](http://msdn.microsoft.com/en-us/library/ee256991.aspx)を使用してすべての修正ライブラリを追加する必要がありました。 – mathieu