我在我的
WPF应用程序中使用Entity Framework和sql CE 4.0.如何根据本文
http://blogs.msdn.com/b/sqlservercompact/archive/2007/06/13/the-story-of-max-database-size-connection-string-parameter.aspx设置最大数据库大小:
we don’t always grow to 4 GB,it is not wise to allocate shared memory
to accommodate all page entries/references to support 4 GB.
The database file is larger than the configured maximum database size.
解决方法
这似乎有效:
sqlCeConnectionFactory sqlCeConnection = new sqlCeConnectionFactory("System.Data.sqlServerCe.4.0","","Max Database Size=4000;Persist Security Info=False;"); DbDatabase.DefaultConnectionFactory = sqlCeConnection; DbDatabase.SetInitializer(new SampleData());
其中第三个参数是连接字符串,您更改参数Max Database Size,否则默认为256MB.