Linqpad with Table Storage
Posted
by kaleidoscope
on Geeks with Blogs
See other posts from Geeks with Blogs
or by kaleidoscope
Published on Mon, 22 Mar 2010 04:40:14 GMT
Indexed on
2010/03/22
5:41 UTC
Read the original article
Hit count: 526
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();
© Geeks with Blogs or respective owner