尝试配置BuildSessionFactory().上的SQL Ce数据库,并获得以下异常
同样的配置也适用于SQLite,但我以前没有在NHibernate中使用过SQLCe。
有什么建议吗?
参考文献:
System.Data.SqlServerCe 3.5.1.0
FluentNHibernate 1.2
NHibernate 3.1配置:
Dim fluentConfiguration = Fluently.Configure() _
.Database(MsSqlCeConfiguration.Standard.ConnectionString(connectionString)) _
.Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of InstrumentMap)() _
.Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never())) _
.ExposeConfiguration(Function(c) InlineAssignHelper(cfg, c)) _
.Cache(Function(c) c.UseQueryCache())
sessionFactory = fluentConfiguration.BuildSessionFactory()DBConnection.cs中的异常,at:
virtual public DataTable GetSchema(string collectionName) {
throw ADP.NotSupported();
} 不支持
System.NotSupportedException已发生Message=Specified方法。System.Data.Common.DbConnection.GetSchema(String Source=System.Data StackTrace: at StackTrace collectionName) InnerException:
顺便说一句,如果我省略了.ExposeConfiguration(..),就会得到同样的异常。
发布于 2011-12-09 13:47:01
GetSchema不受3.5的支持,但SQLServerCompact4.0支持GetSchema
发布于 2012-02-13 15:05:55
GetSchema()在启动期间由Hibernate调用。在其默认设置中,它试图确定db架构是否仍然合适。如果模式不同,Hibernate能够更新架构--如果数据库能够报告其当前模式。正如Erik已经声明的那样: SQL CE无法报告当前架构.因此,它本身并不是一个流利的问题。
所以我为你们看到了以下的选择:
避免Hibernate调用InlineAssignHelper?!
你好,七
https://stackoverflow.com/questions/8445970
复制相似问题