Azure Table Storage is my storage technology of choice for my Windows Azure App. For anyone who’s used this technology, you’ll be well aware of its limitations. One in particular is its lack of relational functionality (aka table joins). For example, take the following LINQ query:
from o in context.Orders join c in context.Customers on o.CustomerId equals c.CustomerId select new { o.OrderNo, c.FirstName, c.LastName, o.Total };
This query will simply fail with a The method 'Join' is not supported. error (not to mention I’m also trying to use projection which will also fail).
But I was thinking that wouldn’t it be cool if a query like this just worked, and was smart enough to perform the required asynchronous queries behind the scenes to return the data.
Now of course there would be a performance hit in doing this, but for small datasets the overhead should be more than acceptable. For large data sets, the only workable option is to denormalise your data beforehand.
So I’d like to introduce my (highly experimental) XTableServiceContext:
Download from CodePlex
XTableServiceContext is a replacement to the standard TableServiceContext class provided by Microsoft. It aims to provide identical functionality, but without the limitations. At the time of writing this blog, the following additional features are supported:
- Relationships via Join()
- Projection via Select()
However I hope to keep filling in the gaps (Union, GroupBy etc) as I need more functionality.
Test Harness
Thanks to the guys at Microsoft Australia for giving me some extra CTP tokens, I'm able to publish the test harness while the CTP is still available:
http://storageclientext.cloudapp.net/
Important Note!
Remember that we are still limited by the underlying technology provided by Table Storage, and that this class retrieves data using the most efficient method available. This may mean performing multiple transactions behind the scenes so please keep this in mind.
Please send me your questions, feedback and suggestions!
3 comments:
this is a nice library and looks very suited to a prototype project we are working on.
are you still maintaining this project?
thank you,
tommy
Yes. We use it in our production system so it's often updated.
Anthony.
Just so you are aware, the trunk version is still VS2008, and it runs fine.
When I go through the upgrade path on this to vs2010, it throws an exception during your first join test.
The code under the branch which is vs2010 native doesn't work correctly right off. I'm still investigating why. Maybe it's something stupid I am doing.
-TF
Post a Comment