Ejemplo n.º 1
0
        public DefaultBlobContainerFactory(AzureBlobOptions azureBlobOptions)
        {
            CloudBlobClient blobClient;

            if (azureBlobOptions.ConnectionString != null && CloudStorageAccount.TryParse(azureBlobOptions.ConnectionString, out var cloudStorageAccount))
            {
                blobClient = cloudStorageAccount.CreateCloudBlobClient();
            }
            else if (azureBlobOptions.BaseUri != null && azureBlobOptions.Token != null)
            {
                blobClient = new CloudBlobClient(azureBlobOptions.BaseUri, new StorageCredentials(azureBlobOptions.Token));
            }
            else
            {
                throw new ArgumentException("One of the following must be set: 'ConnectionString' or 'BaseUri'+'Token'!");
            }

            _container = blobClient.GetContainerReference(azureBlobOptions.DocumentContainer);
        }
Ejemplo n.º 2
0
 public AzureBlobFileProvider(AzureBlobOptions azureBlobOptions)
 {
     _blobContainerFactory = new DefaultBlobContainerFactory(azureBlobOptions);
 }