From 162da9a16ca92cd7468b508bfa4dbeef33f2a034 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 15 Apr 2025 18:40:50 +0200 Subject: [PATCH] =?UTF-8?q?Ablehnung=20von=20ICRUDRepository;=20Einf=C3=BC?= =?UTF-8?q?hrung=20der=20IRepository-Schnittstelle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die `ICRUDRepository`-Schnittstelle wurde als veraltet markiert, was bedeutet, dass sie zugunsten der neuen `IRepository`-Schnittstelle abgelehnt wird. Die „IRepository“-Schnittstelle bietet eine verbesserte Abstraktion und Flexibilität, die Methoden zum Erstellen, Lesen, Aktualisieren und Löschen von Entitäten mit Unterstützung für asynchrone Operationen umfasst. --- .../Infrastructure/ICRUDRepository.cs | 1 + .../Infrastructure/IRepository.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 DigitalData.Core.Abstractions/Infrastructure/IRepository.cs diff --git a/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs b/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs index c5562ff..a452a81 100644 --- a/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs +++ b/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs @@ -5,6 +5,7 @@ /// /// The type of the entity this repository works with. /// The type of the identifier for the entity. + [Obsolete("ICRUDRepository has been deprecated. Please use the IRepository interface instead, which provides a better abtraction (e.g. without tracking) and flexibility.")] public interface ICRUDRepository where TEntity : class, IUnique { /// diff --git a/DigitalData.Core.Abstractions/Infrastructure/IRepository.cs b/DigitalData.Core.Abstractions/Infrastructure/IRepository.cs new file mode 100644 index 0000000..fbd9581 --- /dev/null +++ b/DigitalData.Core.Abstractions/Infrastructure/IRepository.cs @@ -0,0 +1,16 @@ +using System.Linq.Expressions; + +namespace DigitalData.Core.Abstractions.Infrastructure; + +public interface IRepository +{ + public Task CreateAsync(TDto dto); + + public Task CreateAsync(IEnumerable dtos); + + public Task> ReadAsync(Expression? expression = null); + + public Task> UpdateAsync(TDto dto, Expression expression); + + public Task> DeleteAsync(Expression expression); +}