Add CancellationToken support to IRepository methods

Updated the IRepository<TEntity> interface to include an optional CancellationToken parameter in the asynchronous methods: CreateAsync, ReadAsync, UpdateAsync, and DeleteAsync. Modified the DbRepository<TDbContext, TEntity> class to align with these changes, ensuring method signatures are consistent with the interface.
This commit is contained in:
Developer 02
2025-04-16 09:17:38 +02:00
parent 72603f836c
commit 1b793e2b75
2 changed files with 10 additions and 10 deletions

View File

@@ -16,27 +16,27 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
Entities = queryFactory(context);
}
public Task<TEntity> CreateAsync<TDto>(TDto dto)
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<TEntity> CreateAsync<TDto>(IEnumerable<TDto> dtos)
public Task<TEntity> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> DeleteAsync<TDto>(Expression expression)
public Task<IEnumerable<TEntity>> DeleteAsync<TDto>(Expression expression, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> ReadAsync(Expression? expression = null)
public Task<IEnumerable<TEntity>> ReadAsync(Expression? expression = null, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> UpdateAsync<TDto>(TDto dto, Expression expression)
public Task<IEnumerable<TEntity>> UpdateAsync<TDto>(TDto dto, Expression expression, CancellationToken ct = default)
{
throw new NotImplementedException();
}