feat(Application.Abstraction): Erstellt, um Schnittstellen von Core.Application zu behandeln

This commit is contained in:
Developer 02
2025-05-20 16:30:31 +02:00
parent 01025ff36f
commit a0696c5e22
35 changed files with 94 additions and 45 deletions

View File

@@ -0,0 +1,32 @@
using System.Linq.Expressions;
namespace DigitalData.Core.Application.Abstraction.Repository;
public interface IRepository<TEntity>
{
public IEntityMapper<TEntity> Mapper { get; }
public Task<TEntity> CreateAsync(TEntity entity, CancellationToken cancellation = default);
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken cancellation = default);
public IReadQuery<TEntity> Read(params Expression<Func<TEntity, bool>>[] expressions);
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken cancellation = default);
public Task DeleteAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellation = default);
#region Obsolete
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
public Task<IEnumerable<TEntity>> ReadAllAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken cancellation = default);
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
public Task<TEntity?> ReadOrDefaultAsync(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken cancellation = default);
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
public Task<IEnumerable<TDto>> ReadAllAsync<TDto>(Expression<Func<TEntity, bool>>? expression = null, CancellationToken cancellation = default);
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
public Task<TDto?> ReadOrDefaultAsync<TDto>(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken cancellation = default);
#endregion
}