Table of Contents

Class ProjectMembershipRepository

Namespace
Builvero.Infrastructure.Repositories
Assembly
Builvero.Infrastructure.dll

Repository implementation for project membership data access operations using Entity Framework Core.

public class ProjectMembershipRepository : IProjectMembershipRepository
Inheritance
ProjectMembershipRepository
Implements
Inherited Members

Remarks

Project memberships represent the relationship between users and projects, including their role and status.

Constructors

ProjectMembershipRepository(ApplicationDbContext)

Initializes a new instance of the ProjectMembershipRepository class.

public ProjectMembershipRepository(ApplicationDbContext context)

Parameters

context ApplicationDbContext

The Entity Framework database context for data access.

Methods

CreateAsync(ProjectMembership, CancellationToken)

Creates a new project membership in the database.

public Task<ProjectMembership> CreateAsync(ProjectMembership membership, CancellationToken cancellationToken = default)

Parameters

membership ProjectMembership

The project membership entity to create.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectMembership>

The created project membership entity with its generated ID.

DeleteAsync(ProjectMembership, CancellationToken)

Deletes a project membership from the database.

public Task DeleteAsync(ProjectMembership membership, CancellationToken cancellationToken = default)

Parameters

membership ProjectMembership

The project membership entity to delete.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task
Repository implementation for project membership data access operations using Entity Framework Core.

GetByProjectAndUserAsync(Guid, Guid, CancellationToken)

Retrieves a project membership by project and user identifiers.

public Task<ProjectMembership?> GetByProjectAndUserAsync(Guid projectId, Guid userId, CancellationToken cancellationToken = default)

Parameters

projectId Guid

The unique identifier of the project.

userId Guid

The unique identifier of the user.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectMembership>

The project membership if found; otherwise, null.

GetByProjectIdAsync(Guid, CancellationToken)

Retrieves all memberships for a project.

public Task<List<ProjectMembership>> GetByProjectIdAsync(Guid projectId, CancellationToken cancellationToken = default)

Parameters

projectId Guid

The unique identifier of the project.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<List<ProjectMembership>>

A list of project memberships with User and Profile loaded.

UpdateAsync(ProjectMembership, CancellationToken)

Updates an existing project membership in the database.

public Task<ProjectMembership> UpdateAsync(ProjectMembership membership, CancellationToken cancellationToken = default)

Parameters

membership ProjectMembership

The project membership entity to update.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<ProjectMembership>

The updated project membership entity.