Class MongoIconStore
Built-in IIconStore backed by MongoDB — the zero-configuration default (MongoDB is
already a platform dependency). Bytes live in their own IconRepositoryCollection, keyed
by a generated reference. Registered by AddThargaTeamRepository via TryAdd, so a
consumer-supplied IIconStore takes precedence.
public class MongoIconStore : IIconStore
- Inheritance
-
MongoIconStore
- Implements
- Inherited Members
Constructors
MongoIconStore(IIconRepositoryCollection, IOptions<IconOptions>, IIconProcessor)
public MongoIconStore(IIconRepositoryCollection collection, IOptions<IconOptions> options = null, IIconProcessor processor = null)
Parameters
collectionIIconRepositoryCollectionoptionsIOptions<IconOptions>processorIIconProcessor
Methods
DeleteAsync(string, CancellationToken)
Delete an icon by reference. A missing reference is a no-op.
public Task DeleteAsync(string reference, CancellationToken cancellationToken = default)
Parameters
referencestringcancellationTokenCancellationToken
Returns
LoadAsync(string, CancellationToken)
Load an icon by the reference returned from SaveAsync(IconKind, string, byte[], string, CancellationToken); null when it does not exist.
public Task<IconContent> LoadAsync(string reference, CancellationToken cancellationToken = default)
Parameters
referencestringcancellationTokenCancellationToken
Returns
SaveAsync(IconKind, string, byte[], string, CancellationToken)
Persist an icon and return an opaque reference to it (an id or URL) for later load/delete
and for storing on the owning team/user record.
public Task<string> SaveAsync(IconKind kind, string ownerKey, byte[] data, string contentType, CancellationToken cancellationToken = default)
Parameters
kindIconKindownerKeystringdatabyte[]contentTypestringcancellationTokenCancellationToken