feat: readOnly-Parameter zur ReadAllAsync-Methode im UserRepRepository hinzufügen

This commit is contained in:
Developer 02 2024-10-29 16:27:29 +01:00
parent 622cb1f702
commit 9e11463ef2
2 changed files with 3 additions and 3 deletions

View File

@ -5,6 +5,6 @@ namespace DigitalData.UserManager.Infrastructure.Contracts
{ {
public interface IUserRepRepository : ICRUDRepository<UserRep, int> public interface IUserRepRepository : ICRUDRepository<UserRep, int>
{ {
Task<IEnumerable<UserRep>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null); Task<IEnumerable<UserRep>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null, bool readOnly = true);
} }
} }

View File

@ -12,9 +12,9 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
{ {
} }
public async Task<IEnumerable<UserRep>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null) public async Task<IEnumerable<UserRep>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null, bool readOnly = true)
{ {
var query = _dbSet.AsNoTracking(); var query = readOnly ? _dbSet.AsNoTracking() : _dbSet.AsQueryable();
if (withUser) if (withUser)
query = query.Include(ur => ur.User); query = query.Include(ur => ur.User);