GenericStoreProxy<TOptions>
Namespace: Proffer.Storage.Internal
Generic IStore proxy to allow direct dependency injection of a IStore<TOptions>.
public class GenericStoreProxy<TOptions> : Proffer.Storage.IStore,
Type Parameters
TOptions
The type of the store options.
Inheritance Object → GenericStoreProxy<TOptions>
Implements IStore, IStore<TOptions>
Properties
Name
Gets the name of the store.
public string Name { get; }
Property Value
Constructors
GenericStoreProxy(IStorageFactory, IOptions<TOptions>)
Initializes a new instance of the GenericStoreProxy<TOptions> class.
public GenericStoreProxy(IStorageFactory factory, IOptions<TOptions> options)
Parameters
factory
IStorageFactory
The storage factory.
options
IOptions<TOptions>
The options.
Exceptions
Methods
InitAsync(CancellationToken)
Initializes the store by creating a container in its IStorageProvider.
public Task InitAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken
Returns
A task that represents the asynchronous operation.
DeleteAsync(IPrivateFileReference)
Deletes the file.
public Task DeleteAsync(IPrivateFileReference file)
Parameters
file
IPrivateFileReference
The reference holding the file path.
Returns
A task that represents the asynchronous operation.
GetAsync(Uri, Boolean)
Gets the file reference from URI.
public ValueTask<IFileReference> GetAsync(Uri file, bool withMetadata)
Parameters
file
Uri
The file uniform resource identifier (URI).
withMetadata
Boolean
If set to true, fetch metadata for the file.
Returns
ValueTask<IFileReference>
The at path.
Exceptions
GetAsync(IPrivateFileReference, Boolean)
Gets the file reference from path.
public ValueTask<IFileReference> GetAsync(IPrivateFileReference file, bool withMetadata)
Parameters
file
IPrivateFileReference
The reference holding the file path.
withMetadata
Boolean
If set to true, fetch metadata for the file.
Returns
ValueTask<IFileReference>
The at path.
ListAsync(String, Boolean, Boolean)
Lists the files under .
public ValueTask<IFileReference[]> ListAsync(string path, bool recursive, bool withMetadata)
Parameters
path
String
The path.
recursive
Boolean
If set to true, recurse the listing across folders.
withMetadata
Boolean
If set to true, fetch metadata for each file.
Returns
ValueTask<IFileReference[]>
The list under .
ListAsync(String, String, Boolean, Boolean)
Lists the files under matching the .
public ValueTask<IFileReference[]> ListAsync(string path, string searchPattern, bool recursive, bool withMetadata)
Parameters
path
String
The path.
searchPattern
String
The search pattern.
recursive
Boolean
If set to true, recurse the listing across folders.
withMetadata
Boolean
If set to true, fetch metadata for each file.
Returns
ValueTask<IFileReference[]>
The list under matching the .
ReadAllBytesAsync(IPrivateFileReference)
Reads the file content.
public ValueTask<Byte[]> ReadAllBytesAsync(IPrivateFileReference file)
Parameters
file
IPrivateFileReference
The reference holding the file path.
Returns
ValueTask<Byte[]>
A containing the file content.
ReadAllTextAsync(IPrivateFileReference)
Reads the file content.
public ValueTask<string> ReadAllTextAsync(IPrivateFileReference file)
Parameters
file
IPrivateFileReference
The reference holding the file path.
Returns
ValueTask<String>
A containing the file content.
ReadAsync(IPrivateFileReference)
Reads the file content.
public ValueTask<Stream> ReadAsync(IPrivateFileReference file)
Parameters
file
IPrivateFileReference
The reference holding the file path.
Returns
ValueTask<Stream>
A containing the file content.
SaveAsync(Stream, IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)
Saves the file.
public ValueTask<IFileReference> SaveAsync(Stream data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)
Parameters
data
Stream
The file content.
file
IPrivateFileReference
The reference holding the file path.
contentType
String
The content-type of the file.
overwritePolicy
OverwritePolicy
The overwrite policy.
metadata
IDictionary<String, String>
The metadata.
Returns
ValueTask<IFileReference>
The saved .
Exceptions
SaveAsync(Byte[], IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)
Saves the file.
public ValueTask<IFileReference> SaveAsync(Byte[] data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)
Parameters
data
Byte[]
The file content.
file
IPrivateFileReference
The reference holding the file path.
contentType
String
The content-type of the file.
overwritePolicy
OverwritePolicy
The overwrite policy.
metadata
IDictionary<String, String>
The metadata.
Returns
ValueTask<IFileReference>
The saved .
Exceptions
GetSharedAccessSignatureAsync(ISharedAccessPolicy)
Gets a shared access signature.
public ValueTask<string> GetSharedAccessSignatureAsync(ISharedAccessPolicy policy)
Parameters
policy
ISharedAccessPolicy
The policy.
Returns
ValueTask<String>
A shared access signature to read or list the store files.