LinqPad with Azure Table Storage
Posted
by Sarang
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Sarang
Published on Wed, 10 Mar 2010 07:42:54 GMT
Indexed on
2010/03/11
4:40 UTC
Read the original article
Hit count: 1339
LinqPad as we all know has been a wonderful tool for running ad-hoc queries. With Windows 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 Windows 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 Windows 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();
Thanks LinqPad!
© Geeks with Blogs or respective owner