I'm working on a MVC 4 project which makes use of NHibernate (version 4.0.0.4000). At the moment, I configured the session factory to use a SQL CE 3.5 file which resides in C:\Db directory.
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();
The problem which I'm experiencing is that sometimes (like once in a day) I get the following error in the execution of a random query (even simple select queries!):
not enough storage space is available to complete this operation
The rest of the time, everything is working flawlessly. Needless to say, I have over 300GB of free space. I did my searches but found absolutely nothing about that error which is relevant to my context. I'm starting to think that there's something wrong with the db .sdf file itself: I created it with SQL Server 2008 R2 but then performed some changes with "Database .NET 3.5", which is a quite handy tool for small changes. Could it be that by doing so I corrupted the .sdf file in some way?
SQL Server Compact 3.5 is not designed for nor supported under ASP.NET. That is most likely why you are getting errors. Use SQL Server Compact 4.0 SP1 instead.