more code behind. and more orga power
This commit is contained in:
@ -12,14 +12,14 @@ namespace UserService.DatabaseLayer.Repository
|
||||
{
|
||||
public class BaseRepository<T> where T : Node
|
||||
{
|
||||
private readonly Func<UserServiceDbContext, DbSet<T>> _context;
|
||||
protected readonly Func<UserServiceDbContext, DbSet<T>> _context;
|
||||
|
||||
protected BaseRepository(Func<UserServiceDbContext, DbSet<T>> context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<T>> GetAllAsync(CancellationToken token = default)
|
||||
public virtual async Task<IReadOnlyList<T>> GetAllAsync(CancellationToken token = default)
|
||||
{
|
||||
await using var db = new UserServiceDbContext();
|
||||
return await _context(db).Include(x => x.Parent).ToListAsync(token);
|
||||
|
Reference in New Issue
Block a user