Class ThumbnailStorageStore
Azure Blob Storage implementation of IThumbnailStorageStore.
Thumbnails are stored as blobs in a dedicated container configured via AzureBlob:ThumbnailContainerName.
The BlobServiceClient instance is shared across all calls (thread-safe singleton field).
Implements
Inherited Members
Namespace: DataWeb.Storage.AzureBlob
Assembly: DataWeb.Storage.AzureBlob.dll
Syntax
public class ThumbnailStorageStore : IThumbnailStorageStore
Constructors
ThumbnailStorageStore(IConfigurationService)
Azure Blob Storage implementation of IThumbnailStorageStore.
Thumbnails are stored as blobs in a dedicated container configured via AzureBlob:ThumbnailContainerName.
The BlobServiceClient instance is shared across all calls (thread-safe singleton field).
Declaration
public ThumbnailStorageStore(IConfigurationService configurationService)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfigurationService | configurationService |
Properties
Name
Gets the unique name that identifies this storage provider.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
DeleteThumbnailsAsync(CancellationToken)
Deletes all thumbnails by removing and recreating the thumbnail container. The container will be temporarily unavailable between the two operations.
Declaration
public Task DeleteThumbnailsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |
DownloadThumbnailStreamAsync(string, CancellationToken)
Opens a read stream for the specified thumbnail blob. Throws if the container or the blob does not exist.
Declaration
public Task<Stream> DownloadThumbnailStreamAsync(string thumbnailName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | thumbnailName | The thumbnail blob name. Must not be null or empty. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<Stream> | A readable Stream backed by Azure Blob Storage. |
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | Thrown when the container or thumbnail blob does not exist. |
IsThumbnailUpToDateAsync(string, DateTimeOffset, CancellationToken)
Determines whether the cached thumbnail is up to date by comparing its last-modified date
with the provided fileDateModified.
Returns false if the container or blob does not exist.
Declaration
public Task<bool> IsThumbnailUpToDateAsync(string thumbnailName, DateTimeOffset fileDateModified, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | thumbnailName | The thumbnail blob name. Must not be null or empty. |
| DateTimeOffset | fileDateModified | The last-modified date of the source file to compare against. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
|
ThumbnailExistsAsync(string, CancellationToken)
Checks whether a thumbnail blob with the given name exists in the thumbnail container.
Returns false if either the container or the blob does not exist.
Declaration
public Task<bool> ThumbnailExistsAsync(string thumbnailName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | thumbnailName | The thumbnail blob name. Must not be null or empty. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
|
UploadThumbnailStreamAsync(Stream, string, CancellationToken)
Uploads a stream as a thumbnail blob, creating the container if it does not exist. Overwrites any existing blob with the same name.
Declaration
public Task UploadThumbnailStreamAsync(Stream stream, string thumbnailName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to upload. The position is reset to 0 before uploading. |
| string | thumbnailName | The target thumbnail blob name. Must not be null or empty. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |