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
contextApplicationDbContextThe 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
membershipProjectMembershipThe project membership entity to create.
cancellationTokenCancellationTokenCancellation 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
membershipProjectMembershipThe project membership entity to delete.
cancellationTokenCancellationTokenCancellation 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
projectIdGuidThe unique identifier of the project.
userIdGuidThe unique identifier of the user.
cancellationTokenCancellationTokenCancellation 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
projectIdGuidThe unique identifier of the project.
cancellationTokenCancellationTokenCancellation 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
membershipProjectMembershipThe project membership entity to update.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<ProjectMembership>
The updated project membership entity.