我正在开发一个使用NHibernate(版本4.0.0.4000)的MVC 4项目。目前,我将会话工厂配置为使用驻留在C:\ Db目录中的SQL CE 3.5文件。
string connString = "Data Source=C:\Db\myDb.sdf; Max Database Size=3096; Persist Security Info=false";
factory = Fluently.Configure()
//per Sql CE 4.0 usare MsSqlCeConfiguration.MsSqlCe40
.Database(MsSqlCeConfiguration.Standard.ConnectionString(connString)
.ShowSql()
.MaxFetchDepth(3)
.Driver<MySqlServerCeDriver>()) // FIX truncation 4000 chars
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.ExposeConfiguration(c =>
{
c.SetProperty("cache.provider_class", "NHibernate.Cache.HashtableCacheProvider");
c.SetProperty("cache.use_query_cache", "true");
c.SetProperty("command_timeout", "120");
})
// FIX BUG per SqlCompact quando si salvano colonne identity
.ExposeConfiguration(c => c.SetProperty("connection.release_mode", "on_close"))
.BuildSessionFactory();
我遇到的问题是,有时候(比如一天一次)我在执行随机查询时会出现以下错误(即使是简单的选择查询!):
not enough storage space is available to complete this operation
其余时间,一切都在完美无缺。不用说,我有超过300GB的可用空间。我做了我的搜索,但没有发现与我的上下文相关的错误。我开始认为db .sdf文件本身有问题:我使用SQL Server 2008 R2创建它,但随后使用“Database .NET 3.5”执行了一些更改,这是一个非常方便的小工具工具。可能是因为这样做我以某种方式破坏了.sdf文件?