Interface IUserRepository<TUserEntity>
public interface IUserRepository<TUserEntity> : IRepository where TUserEntity : EntityBase, IUser
Type Parameters
TUserEntity
Methods
AddAsync(TUserEntity)
Task AddAsync(TUserEntity user)
Parameters
userTUserEntity
Returns
DeleteAsync(string)
Deletes the user document.
Task DeleteAsync(string userKey)
Parameters
userKeystring
Returns
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
identitystring
Returns
- Task<TUserEntity>
GetByEMailAsync(string)
Every user whose EMail is email, compared trimmed and ignoring
case; empty for a blank address.
Task<TUserEntity[]> GetByEMailAsync(string email)
Parameters
emailstring
Returns
- Task<TUserEntity[]>
Remarks
Every match, not the first. Nothing makes an address unique — the built-in collection indexes
only Identity — and a caller deciding whose mail this is has to know when two accounts claim it.
A default interface method that reads every user, so a host's own repository keeps compiling and answers correctly, if slowly; the built-in one asks the database.
GetByKeyAsync(string)
Task<TUserEntity> GetByKeyAsync(string userKey)
Parameters
userKeystring
Returns
- Task<TUserEntity>
GetByKeysAsync(IReadOnlyCollection<string>)
The users with these keys, each once; a key no user has is left out.
Task<TUserEntity[]> GetByKeysAsync(IReadOnlyCollection<string> userKeys)
Parameters
userKeysIReadOnlyCollection<string>
Returns
- Task<TUserEntity[]>
Remarks
A default interface method that asks for one key at a time, so a host's own repository keeps compiling; the built-in one asks the database once.
SearchAsync(string)
The users whose name or address holds text, ignoring case, that are not disabled, as they are read; nothing for empty text.
IAsyncEnumerable<TUserEntity> SearchAsync(string text)
Parameters
textstring
Returns
- IAsyncEnumerable<TUserEntity>
Remarks
A stream, so a caller filtering further stops reading when it has enough. A default interface method that reads every user, so a host's own repository keeps compiling and answers correctly, if slowly; the built-in one asks the database.
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
Returns
SetEMailAsync(string, string)
Sets EMail on the user document.
Task SetEMailAsync(string userKey, string email)
Parameters
Returns
Remarks
Declared with a default implementation so existing custom repositories keep compiling. The default throws rather than no-opping, for the reason DeleteAsync(string) gives: an address that was asked to change and silently did not is a missing implementation dressed as success.
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
Returns
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
Returns
SetNameAsync(string, string)
Task SetNameAsync(string userKey, string name)