您不必再重建樣本存儲客戶端庫。 V1.2它將自動添加三個DLL引用您的角色:
- Microsoft.WindowsAzure.Diagnostics
- Microsoft.WindowAzure.ServiceRuntime
- Microsoft.WindowsAzure.StorageClient
要創建一個表,您需要首先設置表格:
- 創建派生自TableServiceEntity的類(比如說,「MyEntity」) -
- 從TableServiceContext派生表類(例如,「MyEntityDataServiceContext」)。在該類中,創建DataServiceQuery類型的屬性< MyEntity>(),返回CreateQuery < MyEntity>(「MyEntities」);
一旦你做到了這一點,創建碼錶是這樣的:
var account = CloudStorageAccount.DevelopmentStorageAccount;
CloudTableClient.CreateTablesFromModel(typeof(MyEntityDataServiceContext),account.TableEndpoint.AbsoluteUri, account.Credentials);
對於這一個更詳細的研究,下載Azure Platform Training Kit。有一個名爲「探索Windows Azure存儲」的實驗室,涵蓋了所有這些。
+1:只是「automagically」這個詞:o)會讓你知道我是怎麼開始的。感謝你的回答。 – 2010-09-09 13:41:58