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<TEntity>.Where. - Removed old Get() method in favor of new retrieval methods.
This commit is contained in:
@@ -19,12 +19,17 @@ public static class Extensions
|
||||
#endregion
|
||||
|
||||
#region IRepository
|
||||
public static IQueryable<TEntity> Get<TEntity>(this IRepository repository) where TEntity : IEntity
|
||||
=> repository.Entity<TEntity>().Get();
|
||||
#region Read
|
||||
public static IEnumerable<TEntity> GetAll<TEntity>(this IRepository repository) where TEntity : IEntity
|
||||
=> repository.Entity<TEntity>().GetAll();
|
||||
|
||||
public static Task<IEnumerable<TEntity>> GetAllAsync<TEntity>(this IRepository repository) where TEntity : IEntity
|
||||
=> repository.Entity<TEntity>().GetAllAsync();
|
||||
|
||||
public static IQueryable<TEntity> Where<TEntity>(this IRepository repository, Expression<Func<TEntity, bool>> expression)
|
||||
where TEntity : IEntity
|
||||
=> repository.Entity<TEntity>().Where(expression);
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
public static Task<TEntity> CreateAsync<TEntity>(this IRepository repository, TEntity entity, CancellationToken cancel = default)
|
||||
|
||||
Reference in New Issue
Block a user