Developer 02 1b793e2b75 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.
2025-04-16 09:17:38 +02:00

44 lines
1.3 KiB
C#

using DigitalData.Core.Abstractions.Infrastructure;
using Microsoft.EntityFrameworkCore;
using System.Linq.Expressions;
namespace DigitalData.Core.Infrastructure;
public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbContext : DbContext where TEntity : class
{
protected TDbContext Context;
protected DbSet<TEntity> Entities;
public DbRepository(TDbContext context, Func<TDbContext, DbSet<TEntity>> queryFactory)
{
Context = context;
Entities = queryFactory(context);
}
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<TEntity> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> DeleteAsync<TDto>(Expression expression, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> ReadAsync(Expression? expression = null, CancellationToken ct = default)
{
throw new NotImplementedException();
}
public Task<IEnumerable<TEntity>> UpdateAsync<TDto>(TDto dto, Expression expression, CancellationToken ct = default)
{
throw new NotImplementedException();
}
}