From 63c97b4dc709f5784f3cef9ad2e8db35f0aec729 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 12 Sep 2025 11:44:02 +0200 Subject: [PATCH] feat(repository): add GetAll and GetAllAsync methods to IRepository - Introduced GetAll() and GetAllAsync() to provide full entity retrieval options. - Updated obsolete warnings: - Read() now marked with "Use CreateAsync, UpdateAsync or DeleteAsync". - ReadOnly() points to IRepository.Where. - Removed old Get() method in favor of new retrieval methods. --- .../Repository/Extensions.cs | 9 +++++++-- .../Repository/IRepository.cs | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DigitalData.Core.Abstraction.Application/Repository/Extensions.cs b/DigitalData.Core.Abstraction.Application/Repository/Extensions.cs index 60deaa6..d1ff27c 100644 --- a/DigitalData.Core.Abstraction.Application/Repository/Extensions.cs +++ b/DigitalData.Core.Abstraction.Application/Repository/Extensions.cs @@ -19,12 +19,17 @@ public static class Extensions #endregion #region IRepository - public static IQueryable Get(this IRepository repository) where TEntity : IEntity - => repository.Entity().Get(); + #region Read + public static IEnumerable GetAll(this IRepository repository) where TEntity : IEntity + => repository.Entity().GetAll(); + + public static Task> GetAllAsync(this IRepository repository) where TEntity : IEntity + => repository.Entity().GetAllAsync(); public static IQueryable Where(this IRepository repository, Expression> expression) where TEntity : IEntity => repository.Entity().Where(expression); + #endregion #region Create public static Task CreateAsync(this IRepository repository, TEntity entity, CancellationToken cancel = default) diff --git a/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs b/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs index 25cf2bd..835fac7 100644 --- a/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs +++ b/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs @@ -13,7 +13,9 @@ public interface IRepository public IQueryable Where(Expression> expression); - public IQueryable Get(); + public IEnumerable GetAll(); + + public Task> GetAllAsync(); public Task UpdateAsync(TDto dto, Expression> expression, CancellationToken cancel = default); @@ -24,10 +26,10 @@ public interface IRepository public Task DeleteAsync(Func, IQueryable> query, CancellationToken cancel = default); #region Obsolete - [Obsolete("Use IRepository.Where")] + [Obsolete("Use CreateAsync, UpdateAsync or DeleteAsync")] public IQueryable Read(); - [Obsolete("Use IRepository.Get")] + [Obsolete("Use IRepository.Where")] public IQueryable ReadOnly(); #endregion }