feat(Repository): CreateAsync-Methoden für DTO wurden in Erweiterungsmethoden konvertiert

This commit is contained in:
Developer 02
2025-04-22 11:21:21 +02:00
parent 5465fe5b49
commit 3c1bbc1151
3 changed files with 17 additions and 17 deletions

View File

@@ -32,18 +32,6 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
return entities;
}
public virtual Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken ct = default)
{
var entity = Mapper.Map(dto);
return CreateAsync(entity, ct);
}
public virtual Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken ct = default)
{
var entities = dtos.Select(dto => Mapper.Map(dto));
return CreateAsync(entities, ct);
}
public virtual async Task<IEnumerable<TEntity>> ReadAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default)
=> expression is null
? await Entities.AsNoTracking().ToListAsync(ct)