I've got a question about the best method to deploy a SQL Server CE database with this client application. I realize we have to install the SQL Server CE requirements etc., which means this is not an issue about setting it up to operate. It already does.

At this time the way you get it is the fact that we simply ship a duplicate from the .mdf file (that contains no data) using the application, which will get replicated towards the appropriate location throughout installation. This works perfectly fine, but I'm wondering if this sounds like the "correct" approach to implementing a database by having an application or maybe the database ought to be whether.) produced throughout cellular phone (like a custom install action), or b.) produced in the first run from the application.

Any ideas or suggestions are appreciated. I recognize there most likely is not a good response to this.

This really is speaking concerning the *.mdf file, not how to make sure that the SqlServerCE dll can be obtained.

The way you should deploy the database application is strongly determined by the next questions:

May be the database per user?

  • Whether it is not if it is?
    • Getting the database within the programs directory is an awful idea on Vista let's start as it might trigger UAE demands when modifying the file.
  • If it's per user then reasonably you have to generate a replacement for every user, so some code will need to run with this so that you can just like easily use the following techniques.

Otherwise then simply just together with a single initial file works fine and it is the easiest option.

May be the database empty to begin with (i.e.e you can 'create the table structure in code and also have no *.mdf file anywhere to base them back.

  • This will make you testing cleaner but means you can't communicate with the 'initial' database with such things as the SQL Sever tools.
  • When the initial condition is either schema only or really small embedding the 'template' within the dll can make your deployment more flexible and can imply that no-one can accidentally 'break' web site database by getting rid of it/altering it accidentally.

If there's significant data than the probably precludes the embedded option.

Can there be significant data within the initial condition from the database that you might want to change without altering the dll?

  • Possibly you need to personalize it per client
  • Possibly you need to have the ability to produce a custom deployment without producing a brand new build.

If that's the case then you'll likely want the file separate instead of being an embedded resource.