Class FileStore
SQL Server file store implementation. Manages persistence and retrieval of file metadata from the database.
Implements
Inherited Members
Namespace: DataWeb.Media.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class FileStore : IFileStore
Constructors
FileStore(ISqlHelper)
SQL Server file store implementation. Manages persistence and retrieval of file metadata from the database.
Declaration
public FileStore(ISqlHelper sqlHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper |
Properties
Name
Gets the name of the file store.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetFileAsync(FileFilter, CancellationToken)
Retrieves a single file based on the specified filter criteria.
Declaration
public Task<FileData> GetFileAsync(FileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FileFilter | filter | Search criteria. Cannot be null. |
| CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<FileData> | The file found, or null if not found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If filter is null. |
GetFileSettings(string)
Deserializes a JSON string into file settings. Returns null if the value is null or empty.
Declaration
public FileSettings GetFileSettings(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | JSON string to deserialize. |
Returns
| Type | Description |
|---|---|
| FileSettings | Deserialized file settings, or null if value is null or empty. |
GetFilesAsync(FileFilter, CancellationToken)
Retrieves a collection of files based on the specified filters.
Declaration
public Task<IEnumerable<FileData>> GetFilesAsync(FileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FileFilter | filter | Search criteria. Cannot be null. |
| CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<FileData>> | Collection of files matching the filter criteria. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If filter is null. |
UpdateIsInStorageAsync(string, bool, CancellationToken)
Updates the storage status of a file.
Declaration
public Task UpdateIsInStorageAsync(string fileIdMaster, bool isInStorage, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileIdMaster | Unique identifier of the file master record. Cannot be null or empty. |
| bool | isInStorage | Flag indicating whether the file is stored. |
| CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If fileIdMaster is null or empty. |