Updated methods in the `DbRepository` class to be virtual, allowing for overriding in derived classes. Renamed parameters from `dto` to `entity` and `dtos` to `entities` for improved clarity. All methods still throw `NotImplementedException` as implementations are pending.
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using AutoMapper;
|
|
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 readonly TDbContext Context;
|
|
|
|
protected readonly DbSet<TEntity> Entities;
|
|
|
|
protected readonly IMapper Mapper;
|
|
|
|
public DbRepository(TDbContext context, Func<TDbContext, DbSet<TEntity>> queryFactory, IMapper mapper)
|
|
{
|
|
Context = context;
|
|
Entities = queryFactory(context);
|
|
Mapper = mapper;
|
|
}
|
|
|
|
public virtual Task<TEntity> CreateAsync(TEntity entity, CancellationToken ct = default)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public virtual Task<TEntity> CreateAsync(IEnumerable<TEntity> entities, CancellationToken ct = default)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public virtual Task<IEnumerable<TEntity>> DeleteAsync<TDto>(Expression expression, CancellationToken ct = default)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public virtual Task<IEnumerable<TEntity>> ReadAsync(Expression? expression = null, CancellationToken ct = default)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public virtual Task<IEnumerable<TEntity>> UpdateAsync<TDto>(TDto dto, Expression expression, CancellationToken ct = default)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|