I am using Entity Framework and SQL CE 4.0 with my WPF application. How do I set the maximum database size in accordance with this article, http://blogs.msdn.com/b/sqlservercompact/archive/2007/06/13/the-story-of-max-database-size-connection-string-parameter.aspx which states:
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.
Currently, I get the following error when trying to add new data:
The database file is larger than the configured maximum database size.
However, the DB is only reaching close to 256MB, which is in line with the article in the link above.
This seems to work:
SqlCeConnectionFactory sqlCeConnection =
new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0",
"", "Max Database Size=4000;Persist Security Info=False;");
DbDatabase.DefaultConnectionFactory = sqlCeConnection;
DbDatabase.SetInitializer(new SampleData());
Where the third parameter is the connection string and you change the parameter Max Database Size
otherwise it defaults to 256MB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With