無法從
NHibernate.Driver.SqlServerCeDriver, NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
創建驅動程序。使用流利的NHibernate SQL Server CE無法創建驅動程序
內exeption: 在裝配System.Data.SqlServerCe的IDbCommand和執行的IDbConnection找不到。確保程序集System.Data.SqlServerCe位於應用程序目錄或全局程序集緩存中。如果程序集位於GAC中,請使用應用程序配置文件中的元素指定程序集的全名。
這是我在嘗試使用流利的nHibernate時得到的錯誤!
我嘗試通過配置的簡單示例不能很好地與本地數據庫 使用此dll。
我的代碼:
private static String ConnectionString = "Data Source = Database1.sdf";
public static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(MsSqlCeConfiguration.Standard
.ConnectionString(ConnectionString)
.Driver<NHibernate.Driver.SqlServerCeDriver>()
.Dialect<NHibernate.Dialect.MsSqlCeDialect>())
.Mappings(m => m.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly()))
.ExposeConfiguration(BuildSchema)
.ExposeConfiguration(x => x.SetProperty("connection.release_mode", "on_close"))
.BuildSessionFactory();
}
private static void BuildSchema(Configuration configuration)
{
SchemaExport schemaExport = new SchemaExport(configuration);
schemaExport.Execute(false, true, false);
}
謝謝!這很重要!
我發現它打破了buildsessionfactory ... helpppp !!!!
是的,我可以肯定它可能是別的東西嗎?也許東西與組件文件? – user1430430
我加這個exeption的內部豁免..也許它可以幫助 – user1430430
沒關係,我發現它!!!! thanku非常愉快的一天! – user1430430