Introduce `[Obsolete]` attributes to various methods and classes, suggesting alternatives such as MediatR and IRepository. Mark multiple DTOs and repository classes as obsolete, recommending the use of DigitalData.Core.Exceptions and .Middleware or Repository. This change aims to enhance maintainability and clarity in the codebase.
49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using DigitalData.Core.Infrastructure;
|
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
|
using DigitalData.UserManager.Domain.Entities;
|
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
|
|
|
[Obsolete("Use Repository")]
|
|
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
|
where TDbContext : DbContext, IUserManagerDbContext
|
|
{
|
|
public UserRepRepository(TDbContext dbContext) : base(dbContext, dbContext.UserReps)
|
|
{
|
|
}
|
|
|
|
public async Task<IEnumerable<UserRep>> ReadAllAsync(
|
|
bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false,
|
|
int? userId = null, int? repUserId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true)
|
|
{
|
|
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
|
|
|
|
if (withUser)
|
|
query = query.Include(ur => ur.User);
|
|
|
|
if (withRepGroup)
|
|
query = query.Include(ur => ur.RepGroup);
|
|
|
|
if (withGroup)
|
|
query = query.Include(ur => ur.Group);
|
|
|
|
if (withRepUser)
|
|
query = query.Include(ur => ur.RepUser);
|
|
|
|
if (userId is not null)
|
|
query = query.Where(ur => ur.UserId == userId);
|
|
|
|
if (repUserId is not null)
|
|
query = query.Where(ur => ur.RepUserId == repUserId);
|
|
|
|
if (groupId is not null)
|
|
query = query.Where(ur => ur.GroupId == groupId);
|
|
|
|
if (repGroupId is not null)
|
|
query = query.Where(ur => ur.RepGroupId == repGroupId);
|
|
|
|
return await query.ToListAsync();
|
|
}
|
|
} |