This project has moved and is read-only. For the latest updates, please go here.

Deploying a Pre-Populated DB

Mar 3, 2011 at 6:49 PM

Hi all,

I've been following Sterling for a few months now, and with the 1.0 release, I thought I'd ask again: is it possible to somehow deploy a pre-populated database?

I primarily code Silverlight games using the FlatRedBall engine. I've gotten to the point that I need a database (too much data to handle through flat files or generate on-the-fly). This means that I need my game to deploy with an existing database full of pre-populated data.

Ideally, I think this means that I would be running my application locally, and somehow manually inserting records into the DB -- either through some tool, or with a big init function that adds records.

I don't see any other solution, but I would really like to avoid a big init function that deletes all the data and re-creates. 

Is there a better way? I know that Sterling uses Isolated Storage under the hood, which is client-specific (and therefore, deploy-proof).

Mar 4, 2011 at 2:36 AM

I've given the example in the desktop version. There are really two approaches. You can create a program that generates and saves the stream from the backup, then call restore at the start of your app to set things up, or you can parse out files like CSV or JSON and use those to load the database. I'm not sure of any other way to do it (not a Sterling limitation, but isolated storage in general). Does that help?

Mar 4, 2011 at 2:40 AM

I agree, Isolated Storage really has this failing. I think the best thing would be to create an application that will let me manipulate the data, and just import/export from CSV. That saves me from having to write the data-manipulator in Silverlight, too; I can even use plain old spreadsheets to get the job done.

Thanks Jermey, that's greatly helpful for me.