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

The new SDK introduces a new class -

· The CloudTableClient : This new class enables us to create tables and test for the existence of tables. We need not need use this class for querying table storage, it's   more of an administrative class for dealing with table storage itself.  

· Once we have got the account key and the account name from ConfigurationSetting, we can create an instance of the storage credentials and table client classes:

 

StorageCredentialsAccountAndKey creds = new StorageCredentialsAccountAndKey(accountName, accountKey);
    CloudTableClient tableStorage = new CloudTableClient(tableBaseUri, creds);
    CustomerContext ctx = new CustomerContext(tableBaseUri, creds);

    //where tableBaseUri is the TableStorageEndpoint obtained from ConfigurationSetting

Using the table storage class, we can now create a new table (if it doesn't already exist):

    if (tableStorage.CreateTableIfNotExist("Customers"))
    {
       CustomerRow cust = new CustomerRow("AccountsReceivable", "kevin"); 
       cust.FirstName = "Kevin";
       cust.LastName = "Hoffman";
       ctx.AddObject("Customers", cust);
       ctx.SaveChanges();
    }

For a complete article on this topic please follow this link:

http://dotnetaddict.dotnetdevelopersjournal.com/azure_nov09_tablestorage.htm

Tinu

Technorati Tags:
Posted on Sunday, March 21, 2010 4:32 PM | Back to top


Comments on this post: Azure Table Storage Creation using Nov 2009 CTP

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


Copyright © kaleidoscope | Powered by: GeeksWithBlogs.net