您不必再重建样本存储客户端库。 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