Table of Contents

Interface IUserRepository<TUserEntity>

Namespace
Tharga.Team.MongoDB
Assembly
Tharga.Team.MongoDB.dll
public interface IUserRepository<TUserEntity> : IRepository where TUserEntity : EntityBase, IUser

Type Parameters

TUserEntity

Methods

AddAsync(TUserEntity)

Task AddAsync(TUserEntity user)

Parameters

user TUserEntity

Returns

Task

DeleteAsync(string)

Deletes the user document.

Task DeleteAsync(string userKey)

Parameters

userKey string

Returns

Task

Remarks

Declared with a default implementation so existing custom repositories keep compiling. The default throws rather than no-opping: silently skipping a requested deletion would hide the missing implementation behind an apparently successful call.

GetAsync()

IAsyncEnumerable<TUserEntity> GetAsync()

Returns

IAsyncEnumerable<TUserEntity>

GetAsync(string)

Task<TUserEntity> GetAsync(string identity)

Parameters

identity string

Returns

Task<TUserEntity>

GetByKeyAsync(string)

Task<TUserEntity> GetByKeyAsync(string userKey)

Parameters

userKey string

Returns

Task<TUserEntity>

SetDirectoryIdAsync(string, string)

Sets DirectoryId on the user document. Same opt-in-by-entity-shape contract as SetLastSeenAsync(string, DateTime): a no-op unless the entity declares a DirectoryId property.

Task SetDirectoryIdAsync(string userKey, string directoryId)

Parameters

userKey string
directoryId string

Returns

Task

SetIconAsync(string, string)

Sets Icon (the icon reference) on the user document. Same opt-in-by-entity-shape contract as SetDirectoryIdAsync(string, string): a no-op unless the entity declares an Icon property.

Task SetIconAsync(string userKey, string reference)

Parameters

userKey string
reference string

Returns

Task

SetLastSeenAsync(string, DateTime)

Stamps LastSeen on the user document. Called automatically by the throttled resolve path, so the default (and the built-in repository, when TUserEntity does not declare a LastSeen property) is a no-op — activity tracking is opted into by declaring the property on the entity.

Task SetLastSeenAsync(string userKey, DateTime lastSeen)

Parameters

userKey string
lastSeen DateTime

Returns

Task

SetNameAsync(string, string)

Task SetNameAsync(string userKey, string name)

Parameters

userKey string
name string

Returns

Task