chore: Refactor project structure and update DI setup
Die Datei `DIExtensions.cs` wurde erheblich überarbeitet, um Abhängigkeiten von der Schicht `DigitalData.UserManager.Infrastructure` zu entfernen. Die Methode `AddUserManager` wurde vereinfacht und eine Methode `AddEncryptor` hinzugefügt. Die Projektverweise auf die Infrastrukturebene in der Anwendungsprojektdatei wurden entfernt. Aktualisierte Servicedateien zur Verwendung neuer Repository-Schnittstellen aus „DigitalData.UserManager.Application.Contracts.Repositories“. Repository-Schnittstellen wurden in den Namensraum für Anwendungsverträge verschoben und ihre Definitionen aktualisiert. Einführung von `DependencyInjection.cs` für die Handhabung von Infrastrukturdienstregistrierungen. Aktualisierte Repository-Implementierungen, um sie an die neue Struktur anzupassen, die Trennung von Belangen zu verbessern und die Injektion von Abhängigkeiten zu vereinfachen.
This commit is contained in:
@@ -1,48 +1,48 @@
|
||||
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
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||
|
||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
public UserRepRepository(TDbContext dbContext) : base(dbContext, dbContext.UserReps)
|
||||
{
|
||||
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();
|
||||
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 (withUser)
|
||||
query = query.Include(ur => ur.User);
|
||||
|
||||
if (withRepGroup)
|
||||
query = query.Include(ur => ur.RepGroup);
|
||||
if (withRepGroup)
|
||||
query = query.Include(ur => ur.RepGroup);
|
||||
|
||||
if (withGroup)
|
||||
query = query.Include(ur => ur.Group);
|
||||
if (withGroup)
|
||||
query = query.Include(ur => ur.Group);
|
||||
|
||||
if (withRepUser)
|
||||
query = query.Include(ur => ur.RepUser);
|
||||
if (withRepUser)
|
||||
query = query.Include(ur => ur.RepUser);
|
||||
|
||||
if (userId is not null)
|
||||
query = query.Where(ur => ur.UserId == userId);
|
||||
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 (repUserId is not null)
|
||||
query = query.Where(ur => ur.RepUserId == repUserId);
|
||||
|
||||
if (groupId is not null)
|
||||
query = query.Where(ur => ur.GroupId == groupId);
|
||||
if (groupId is not null)
|
||||
query = query.Where(ur => ur.GroupId == groupId);
|
||||
|
||||
if (repGroupId is not null)
|
||||
query = query.Where(ur => ur.RepGroupId == repGroupId);
|
||||
if (repGroupId is not null)
|
||||
query = query.Where(ur => ur.RepGroupId == repGroupId);
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user