Пример #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);
            }
        }