public CosmosDBHostedFilesService(IOptions <AzureServicesConfiguration> azureOptions, IFileStorageService fileStorage) { if (azureOptions == null) { throw new ArgumentNullException(nameof(azureOptions)); } if (fileStorage == null) { throw new ArgumentNullException(nameof(fileStorage)); } this.fileStorage = fileStorage; azureConfig = azureOptions.Value; Collections.InitCollections(azureConfig.CosmosDBId); database = new Database { Id = azureConfig.CosmosDBId }; userFilesCollection = new DocumentCollection { Id = Collections.Ids.UserFiles }; var cosmosEndpointUri = new Uri(azureConfig.CosmosDBEndpointUrl); docClient = new DocumentClient(cosmosEndpointUri, azureConfig.CosmosDBKey); initSemaphore = new SemaphoreSlim(1, 1); }
private static CloudTable CreateTable() { var config = new AzureServicesConfiguration(); var storageAccount = config.EmailQueueStorageAccount; var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference("bademail"); table.CreateIfNotExistsAsync().Wait(); return(table); }
public BlobStorageFileStorageService(IOptions <AzureServicesConfiguration> azureOptions) { if (azureOptions == null) { throw new ArgumentNullException(nameof(azureOptions)); } azureConfig = azureOptions.Value; cloudStorage = CloudStorageAccount.Parse(azureConfig.BlobStorageConnectionString); blobClient = cloudStorage.CreateCloudBlobClient(); blobContainer = blobClient.GetContainerReference(azureConfig.BlobStorageContainer); initSemaphore = new SemaphoreSlim(1, 1); }