Database access in Windows 8 Metro Application
Even though what we have is still the initial developer preview, creating Metro applications seems to be gaining popularity in developer communities. Although we can create interesting applications using HTML5 and WinJS or XAML and C# or VB.NET, on top of WinRT, there are some unanswered questions like working with databases.
Any enterprise applications typically will work with some database at the backend. As of now, however, WinRT does not have any API for database connectivity.
As per our understanding today, distribution of metro application will be done through app stores. In this case it would be difficult to distribute database along with the applications. So how do we work with database in metro application?
While discussing with my colleague Dhananjay, we came to the conclusion that all the operations on databases must be done through service. Probably metro application will work with databases in the same way today Windows Phone 7 (WP7) is working, though WP7 still has access to local lightweight database.
If we are creating metro application using XAML and C# then WCF RIA Service support is given to work with server database. In case of HTML5 and WinJS, IndexeDB may be used as the database (though under the hood this is isolated storage and not real database).
We will have to wait and see how database support is provided in WinRT runtime when the beta build is release. If you have any viewpoints or comments on this, we will be glad to hear them.