Reputation: 48537
I have tried to use the samples that Roger Jennings recommeded in his book, "Cloud Computing with Windows Azure", but he is using version 1. I'm using v1.2 and there is a lot of differences. Firstly, I had to recompile the StorageClient DLL with the corrected namespace and other changes. Then, when I use his code to create a Table at the application start, I get an "out of range index".
Has anyone managed to successfully create a Table at application startup? If so, how? Also, if there are any tutorials/samples that use version 1.2, I'd greatly appreciate them too.
Upvotes: 4
Views: 1635
Reputation: 71031
You no longer have to rebuild the sample storage client library. v1.2 will automagically add three DLL references to your role:
To create a table, you'll need to first set up your table :
Once you've done that, create the table with code like this:
var account = CloudStorageAccount.DevelopmentStorageAccount;
CloudTableClient.CreateTablesFromModel(typeof(MyEntityDataServiceContext),account.TableEndpoint.AbsoluteUri, account.Credentials);
For a much more detailed look at this, download the Azure Platform Training Kit. There's a lab called "Exploring Windows Azure Storage" that covers all this.
Upvotes: 6