Using SQL Server Compact Edition with mojoPortal

Discontinued: As of mojoPortal 2.5, SQL CE is no longer supported.

As of version, mojoPortal now supports using SQL CE for the database. You should download the file from Codeplex. It does require .NET 4.0 hosting. The package is an MsDeploy package so it can be imported into IIS or unzippd and installed manually.

SQL CE is ideal for low to moderate traffic sites, because it is very easy to deploy. The database is just a file on disk and he dlls needed to run SQL CE are located in the /bin folder of the mojoPortal package, so no additional software needs to be installed on the server or hosting. It also works in Medium Trust hosting and the package is pre-configured for Medium Trust deployment since most shared hosting enforces Medium Trust. Best of all, if your traffic outgrows the capabilities of SQL CE, it is possible to migrate to SQL Server (Documentation how to do this is coming soon).

For anyone who is deciding between SQL CE and SQLite, my testing found that SQL CE can handle significantly more traffic than SQLite.

When you install the mojoPortal package for SQL CE, the setup system will create the database file if it does not already exist at /App_Data/mojodb.sdf

The name of the file is determined by the Web.config setting

<add key="SqlCeApp_Data_FileName" value="mojodb.sdf" />

you could use a different name though it must have the .sdf extension. If you change the name in this setting and then visit the /Setup/Default.aspx page it will create a new database using the name you specified. Typically you will not need to change this setting. Since it only creates the database if the file does not exist, it makes upgrading easy. We don't include a mojodb.sdf in the package so upgrading will not overwrite your database file.

See Also