I have had a small number of requests to enhance the functionality of my Windows Phone 7 database project on CodePlex. In light of Mango release for WP 7 that will contain SQL CE database, I think that my project will likely be used less in just a few months. The reason being is that once the users update, the reason to use Isolated storage to persist data becomes less appealing. I am not knocking on my own project, I am just recognizing the reality. Having said that, the database will likely still be in use for a while, since we have to wait for the actual phone users to update the version, which cannot be done via 3G, you have to use Zune to update. Because of that, I think, I decided to implement the most request feature, specifically named tables. In other words, right now you can create a table in my database and give it a type of data to store, such as :
What named tables allow you to do, is horizontally partition your data by allowing multi0ple tables to store the same type, such as:
string name2 = "p2";
Database db = Database.CreateDatabase("test");
So, the syntax pretty much remains the same, so anywhere you used to refer to db.Table<T>, you can now also use db.Table<T>(tableName). This includes all functions, such as adding of rows and querying.
Nothing else changes. One thing to notice, that this is pretty deep change that required me to touch a lot of code and test legacy data to ensure it opens properly. As always, I did my due diligence, as you can gather from the tiny number of reported issues in over a year of usage. Nevertheless, I encourage everyone to thoroughly test your applications. You can open up my test project and see how I tested legacy data by looking at the method NamedTablesLegacyTest in my test page in test project. As a result, I am going to publish this release under alpha version until I get some feedback that is sufficient enough to warrant beta status.
I made another small change, making DoesTableExist method public.