Class UserServiceRepositoryBase<TUserEntity>
public abstract class UserServiceRepositoryBase<TUserEntity> : UserServiceBase, IUserService, IUserCacheInvalidator where TUserEntity : EntityBase, IUser
Type Parameters
TUserEntity
- Inheritance
-
UserServiceRepositoryBase<TUserEntity>
- Implements
- Derived
- Inherited Members
Constructors
UserServiceRepositoryBase(AuthenticationStateProvider, IUserRepository<TUserEntity>, ILogger<UserServiceBase>, IIconStore, ITeamCache)
protected UserServiceRepositoryBase(AuthenticationStateProvider authenticationStateProvider, IUserRepository<TUserEntity> userRepository, ILogger<UserServiceBase> logger = null, IIconStore iconStore = null, ITeamCache cache = null)
Parameters
authenticationStateProviderAuthenticationStateProviderResolves the calling principal when none is supplied.
userRepositoryIUserRepository<TUserEntity>The user collection this service reads and writes.
loggerILogger<UserServiceBase>Optional. Used to report activity-stamping failures.
iconStoreIIconStoreOptional. Required only for user icons.
cacheITeamCacheOptional. Forward it from your own service's constructor when running more than one instance — left unforwarded, the resolved-user lookup falls back to a process-local cache that cannot see a user disabled through another instance. See ITeamCache.
Methods
CreateUserEntityAsync(ClaimsPrincipal, string)
protected abstract Task<TUserEntity> CreateUserEntityAsync(ClaimsPrincipal claimsPrincipal, string identity)
Parameters
claimsPrincipalClaimsPrincipalidentitystring
Returns
- Task<TUserEntity>
DeleteUserAsync(string)
public override Task DeleteUserAsync(string userKey)
Parameters
userKeystring
Returns
GetAllAsync()
protected override IAsyncEnumerable<IUser> GetAllAsync()
Returns
GetUserAsync(ClaimsPrincipal)
protected override Task<IUser> GetUserAsync(ClaimsPrincipal claimsPrincipal)
Parameters
claimsPrincipalClaimsPrincipal
Returns
GetUserByKeyAsync(string)
The user with the given key, or null. The default implementation scans GetAsync(); storage-backed services override it with a direct read.
public override Task<IUser> GetUserByKeyAsync(string userKey)
Parameters
userKeystring
Returns
SeedUserNameAsync(string, string)
Sets the user's display name only if it is currently null/empty. Used by the invitation-accept flow to promote the admin-entered invitation name into the new user's identity without clobbering an IdP-provided name.
public override Task SeedUserNameAsync(string userKey, string name)
Parameters
Returns
SetUserDirectoryIdAsync(string, string)
Links the user to their external-directory id (DirectoryId). Called by the oid backfill (internal self-call) and by directory verification on an email-fallback match (relink). Default is a no-op — stores that track the directory id override it.
public override Task SetUserDirectoryIdAsync(string userKey, string directoryId)
Parameters
Returns
SetUserIconReferenceAsync(string, string)
Backs SetOwnIconAsync(byte[], string) / ClearOwnIconAsync() — persists the icon reference (or null to clear) on the user document. Default no-op; stores that track Icon override it.
protected override Task SetUserIconReferenceAsync(string userKey, string reference)
Parameters
Returns
SetUserLastSeenAsync(string, DateTime)
Stamps when the user last made an authenticated request. The automatic throttled stamping is an internal self-call that bypasses the authorization decorator; calling this member from outside requires Manage. The default is a no-op — stores that track LastSeen override it.
public override Task SetUserLastSeenAsync(string userKey, DateTime lastSeen)
Parameters
Returns
SetUserNameAsync(string, string)
Always sets the user's display name. Used by the user self-edit flow where the caller has explicitly chosen a name for themselves.
public override Task SetUserNameAsync(string userKey, string name)