Updated IRepository<TEntity> to include new generic methods for creating and reading entities from DTOs. Modified UpdateAsync to accept DTOs instead of generic types. Implemented corresponding methods in DbRepository<TDbContext, TEntity> for mapping DTOs to entities during creation and updating processes.
21 lines
904 B
C#
21 lines
904 B
C#
using System.Linq.Expressions;
|
|
|
|
namespace DigitalData.Core.Abstractions.Infrastructure;
|
|
|
|
public interface IRepository<TEntity>
|
|
{
|
|
public Task<TEntity> CreateAsync(TEntity entity, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken ct = default);
|
|
|
|
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken ct = default);
|
|
|
|
public Task<IEnumerable<TEntity>> ReadAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
|
|
|
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
|
|
|
public Task DeleteAsync<TDto>(Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
|
}
|