public async static Task CreateTablesIfNotExistsAsync() { CloudStorageAccount storageAccount; if (StorageConnectionType == StorageConnectionType.Key) { storageAccount = new CloudStorageAccount(new StorageCredentials(StorageName, ConnectionKey), true); } else if (StorageConnectionType == StorageConnectionType.ConnectionString) { storageAccount = CloudStorageAccount.Parse(ConnectionKey); } else { throw new NotImplementedException("Unknown Unimplemented Connection to Storage"); } var tableClient = storageAccount.CreateCloudTableClient(); var tasks = new Task <bool>[] { tableClient.GetTableReference(TableAssist.Jobs()).CreateIfNotExistsAsync(), tableClient.GetTableReference(TableAssist.JobInstances()).CreateIfNotExistsAsync(), tableClient.GetTableReference(TableAssist.JobInstanceDetails()).CreateIfNotExistsAsync(), }; await Task.WhenAll(tasks); }
public static void CreateTablesIfNotExists() { CloudStorageAccount storageAccount; if (StorageConnectionType == StorageConnectionType.Key) { storageAccount = new CloudStorageAccount(new StorageCredentials(StorageName, ConnectionKey), true); } else if (StorageConnectionType == StorageConnectionType.ConnectionString) { storageAccount = CloudStorageAccount.Parse(ConnectionKey); } else { throw new NotImplementedException("Unknown Unimplemented Connection to Storage"); } var tableClient = storageAccount.CreateCloudTableClient(); tableClient.GetTableReference(TableAssist.Jobs()).CreateIfNotExists(); tableClient.GetTableReference(TableAssist.JobInstances()).CreateIfNotExists(); tableClient.GetTableReference(TableAssist.JobInstanceDetails()).CreateIfNotExists(); }