refactor: rename Read/ReadOnly methods and mark them as obsolete

- Renamed `Read()` to `Where()` and `ReadOnly()` to `Get()` for clarity.
- Marked old `Read()` and `ReadOnly()` methods as `[Obsolete]` with guidance to use the new methods.
- Updated XML region to separate obsolete methods for better maintainability.
This commit is contained in:
tekh 2025-09-10 17:30:47 +02:00
parent 4972f05fdf
commit 0809d1215b

View File

@ -33,9 +33,9 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
return entities;
}
public IQueryable<TEntity> Read() => Entities.AsQueryable();
public IQueryable<TEntity> Where() => Entities.AsQueryable();
public IQueryable<TEntity> ReadOnly() => Entities.AsNoTracking();
public IQueryable<TEntity> Get() => Entities.AsNoTracking();
public virtual Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default) => UpdateAsync(dto, q => q.Where(expression), cancel);
@ -65,4 +65,12 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
await Context.SaveChangesAsync(cancel);
}
#region Obsolete
[Obsolete("Use IRepository<TEntity>.Where")]
public IQueryable<TEntity> Read() => Entities.AsQueryable();
[Obsolete("Use IRepository<TEntity>.Get")]
public IQueryable<TEntity> ReadOnly() => Entities.AsNoTracking();
#endregion
}