Reputation: 265
I would like to know how to create Azure Table With Schema without inserting any entities into it. With following code it creates a table on azure:
StorageCredentialsAccountAndKey accountAndKey = new StorageCredentialsAccountAndKey("accountName", "accountKey");
CloudStorageAccount storageAccount = new CloudStorageAccount(accountAndKey, true);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
string tableName = "mytable";
tableClient.CreateTableIfNotExist(tableName);
How to specify the schema while creating table.I need to create a empty table(without any records) with custom fields like CustomerFirstName,CustomerLastName,Age..
Regards, Vivek
Upvotes: 0
Views: 1254
Reputation: 60143
Windows Azure tables don't have schema, so there's no way to do this.
(Caveat: the local storage emulator essentially has schema, due to an accident of implementation. If you're working with the emulator, you might try inserting and then immediately deleting an entity with all the properties you care about. That will have no effect on cloud storage, but the emulator will erroneously retain some schema.)
Upvotes: 2