Geeks With Blogs
Kaleidoscope Everything under the sun, ending in .Net

LinqPad as we all know has been a wonderful tool for running ad-hoc queries. With Azure Table storage in picture LinqPad was no longer in picture and we shifted focus to Cloud Storage Studio only to realize the limited and strange querying capabilities of CSS. With some tweaking to Linqpad we can get the comfortable old shoe of ad-hoc queries with LinqPad in the Azure Table storage.

Steps:

1. Start LinqPad

2. Right Click in the query window and select “Query Properties”

3. In The Additional References add reference to Microsoft.WindowsAzure.StorageClient, System.Data.Services.Client.dll and the assembly containing the implementation of the DataServiceContext class tied to the Azure table storage.

4. In the additional namespace imports import the same three namespaces mentioned above.

5. Then we need to provide following details.

a. Table storage account name and shared key.

b. DataServiceContext implementing class in your code.

c. A LINQ query.

e.x.

var storageAccountName = "myStorageAccount";  // Enter valid storage account name

var storageSharedKey = "mysharedKey"; // Enter valid storage account shared key

var uri = new System.Uri("http://table.core.windows.net/");

var storageAccountInfo = new CloudStorageAccount(new StorageCredentialsAccountKey(storageAccountName, storageSharedKey), false);

var serviceContext = new TweetPollDataServiceContext(storageAccountInfo); // Specify the DataServiceContext implementation

// The query

var query = from row in serviceContext.Table

select row;

        query.Dump();

Sarang

Technorati Tags:
Posted on Sunday, March 21, 2010 5:40 PM | Back to top


Comments on this post: Linqpad with Table Storage

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © kaleidoscope | Powered by: GeeksWithBlogs.net