VistaDB with Silverlight

Michael Schwarz on Friday, June 8, 2007

Today I read on the VistaDB blog [1] that their database engine will run on Silverlight [2]. I'm not sure if I want to put a complete database engine in Silverlight applications [3]. Do I have to put the database files into IsolatedStorage or will it be only in-memory?

"OK, great you have this Silverlight application, how are you going to store the data? That’s right, using VistaDB! Since we are 100% managed we can live inside the Silverlight runtime and store the data for you. I think this is where the power of VistaDB being 100% managed is really going to start showing. You simply cannot embed any other type of database into Silverlight. Unless they are written in C#, and are 100% typesafe they cannot run in Silverlight. You cannot call COM interop, you cannot use a Delphi app with a managed wrapper. It must be 100% dot net."

I hope to have some time to look at VistaDB during the weekend. 100% .NET does not mean that everything that is written in C# is running in Silverlight automatically. Silverlight has only a subset of the .NET Framework included to have smaller plugin download size. So I'm more anxious to see it running in a Silverlight Web application.

Update 1: I got a message from VistaDB that it is not yet available, but I will get some bits and bytes next to test it.

Update 2: Here is the answer I got from Jason: "We already work with the CF, so we know how to scale back API's already. And yes, we work with isolated storage, and in memory databases today already (and we support partially trusted environments). So we feel there will be very little changes required to support Silverlight. I actually got a note from a MS employee telling me that they had us working with some tweaks internally to test Silverlight already. So that is what got me fired up to make it work out of the box so to speak. He told me that VistaDB under Silverlight would be a big success story for the framework and he wants to give us whatever resources we need to make that happen."

Maybe you have already heared about Google Gears [4]. It is a small plugin that can act as a server [5] to cache and serve application resources i.e. HTML, JavaScript or images. Another features is the database [6] which is accessible like SQLLite database system. You can create and access tables with common SQL commands directly in JavaScript:

`var db = google.gears.factory.create('beta.database', '1.0');

var rs = db.execute('SELECT recipe.rowid FROM recipe, recipe_aux ' + ' WHERE recipe.rowid = recipe_aux.rowid AND ' + ' recipe_aux.rating > ? AND recipe MATCH ?', [3, 'cheese']);

while (rs.isValidRow()) { console.log(rs.fieldName(0) + " == " + rs.field(0));; }

rs.close(); `

I found an example where the Google Gears database is used from Silverlight [7], so this is working, too.