Table of Contents

Class InMemoryCredentialRepository

Namespace
Core.CliniCore.Repositories.InMemory
Assembly
Core.CliniCore.dll

In-memory implementation of ICredentialRepository. Maintains a secondary index by username for O(1) authentication lookups.

public class InMemoryCredentialRepository : InMemoryRepositoryBase<UserCredential>, ICredentialRepository, IRepository<UserCredential>
Inheritance
InMemoryCredentialRepository
Implements
Inherited Members

Methods

Add(UserCredential)

Adds a new credential and updates the username index.

public override void Add(UserCredential entity)

Parameters

entity UserCredential

Delete(Guid)

Deletes a credential and removes from the username index.

public override void Delete(Guid id)

Parameters

id Guid

Exists(string)

Checks if a username already exists.

public bool Exists(string username)

Parameters

username string

Returns

bool

GetByUsername(string)

Gets a credential by username (the natural key for authentication).

public UserCredential? GetByUsername(string username)

Parameters

username string

Returns

UserCredential

Register(Guid, string, string, string)

Registers a new credential with password hashing.

public UserCredential? Register(Guid id, string username, string password, string role)

Parameters

id Guid
username string
password string
role string

Returns

UserCredential

Search(string)

Searches credentials by username (partial match).

public override IEnumerable<UserCredential> Search(string query)

Parameters

query string

Returns

IEnumerable<UserCredential>

Update(UserCredential)

Updates an existing credential. Username changes are not allowed.

public override void Update(UserCredential entity)

Parameters

entity UserCredential