예제 #1
0
 public BlobFileStore(BlobStorageOptions options, IClock clock, IContentTypeProvider contentTypeProvider)
 {
     _options             = options;
     _clock               = clock;
     _contentTypeProvider = contentTypeProvider;
     _storageAccount      = CloudStorageAccount.Parse(_options.ConnectionString);
     _blobClient          = _storageAccount.CreateCloudBlobClient();
     _blobContainer       = _blobClient.GetContainerReference(_options.ContainerName);
     _verifyContainerTask = Task.Run(async() =>
     {
         try
         {
             await _blobContainer.CreateIfNotExistsAsync();
             await CreateBasePathIfNotExistsAsync();
             await _blobContainer.SetPermissionsAsync(new BlobContainerPermissions()
             {
                 PublicAccess = BlobContainerPublicAccessType.Blob
             });
         }
         catch (Exception ex)
         {
             throw new FileStoreException($"Error while creating or setting permissions on container {_options.ContainerName}.", ex);
         }
     });
 }
예제 #2
0
 public BlobFileStore(BlobStorageOptions options, IClock clock, IContentTypeProvider contentTypeProvider)
 {
     _options             = options;
     _clock               = clock;
     _contentTypeProvider = contentTypeProvider;
     _storageAccount      = CloudStorageAccount.Parse(_options.ConnectionString);
     _blobClient          = _storageAccount.CreateCloudBlobClient();
     _blobContainer       = _blobClient.GetContainerReference(_options.ContainerName);
 }
예제 #3
0
        public BlobFileStore(BlobStorageOptions options, IClock clock, IContentTypeProvider contentTypeProvider)
        {
            _options             = options;
            _clock               = clock;
            _contentTypeProvider = contentTypeProvider;

            _blobContainer = new BlobContainerClient(_options.ConnectionString, _options.ContainerName);

            if (!String.IsNullOrEmpty(_options.BasePath))
            {
                _basePrefix = NormalizePrefix(_options.BasePath);
            }
        }