Table of Contents

Interface ILocalLoginRepository

Namespace
adas_core.LocalLogin
Assembly
adas-core.LocalLogin.dll

Interface for the LocalLoginRepository, which provides methods for managing user authentication and authorization data in a MongoDB database. This repository allows for operations such as retrieving all users, getting a user by ID or email, and updating or inserting user records. It serves as an abstraction layer between the application and the MongoDB database, ensuring that the data access logic is encapsulated and can be easily maintained or modified in the future.

public interface ILocalLoginRepository : IMongoRepository<User>
Inherited Members
Extension Methods

Methods

GetAll()

Retrieves a list of all users from the MongoDB database. This method is asynchronous and returns a Task that resolves to a List of User objects.

Task<List<User>> GetAll()

Returns

Task<List<User>>

A Task that resolves to a List of User objects.

GetByEmail(string)

Retrieves a user from the MongoDB database by their email address. This method is asynchronous and returns a Task that resolves to a User object if found, or null if no user with the specified email exists.

Task<User?> GetByEmail(string email)

Parameters

email string

The email address of the user to retrieve.

Returns

Task<User>

A Task that resolves to a User object if found, or null if no user with the specified email exists.

GetById(ObjectId)

Retrieves a user from the MongoDB database by their unique identifier (ID). This method is asynchronous and returns a Task that resolves to a User object if found, or null if no user with the specified ID exists.

Task<User?> GetById(ObjectId id)

Parameters

id ObjectId

The unique identifier of the user to retrieve.

Returns

Task<User>

A Task that resolves to a User object if found, or null if no user with the specified ID exists.

GetByUsername(string)

Retrieves a user from the MongoDB database by their username. This method is asynchronous and returns a Task that resolves to a User object if found, or null if no user with the specified username exists.

Task<User?> GetByUsername(string username)

Parameters

username string

The username of the user to retrieve.

Returns

Task<User>

A Task that resolves to a User object if found, or null if no user with the specified username exists.

InsertUserOneAsync(User)

Inserts a new user into the MongoDB database. This method is asynchronous and takes a User object as a parameter.

Task<bool> InsertUserOneAsync(User user)

Parameters

user User

The User object to insert into the database.

Returns

Task<bool>

A Task that resolves to a boolean value indicating whether the insertion was successful (true) or not (false).

UpdateOneUserAsync(ObjectId, User)

Updates an existing user in the MongoDB database. This method is asynchronous and takes the user's unique identifier (ID) and the updated User object as parameters. It returns a Task that resolves to a boolean value indicating whether the update was successful (true) or not (false).

Task<bool> UpdateOneUserAsync(ObjectId id, User user)

Parameters

id ObjectId

The unique identifier of the user to update.

user User

The updated User object.

Returns

Task<bool>

A Task that resolves to a boolean value indicating whether the update was successful (true) or not (false).