Table of Contents

Class MongoIconStore

Namespace
Tharga.Team.MongoDB
Assembly
Tharga.Team.MongoDB.dll

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

collection IIconRepositoryCollection
options IOptions<IconOptions>
processor IIconProcessor

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

reference string
cancellationToken CancellationToken

Returns

Task

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

reference string
cancellationToken CancellationToken

Returns

Task<IconContent>

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

kind IconKind
ownerKey string
data byte[]
contentType string
cancellationToken CancellationToken

Returns

Task<string>