From b0896c214f33fcaa0c634b339951fa116abd2a55 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Oct 2024 14:12:04 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=C3=9Cberladungen=20der=20Read-Methode?= =?UTF-8?q?=20f=C3=BCr=20ProfileObjStateRepository=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Überladene ReadAsync-Methoden in ProfileObjStateRepository implementiert, um Filterung nach Benutzer und Status zu ermöglichen. - Die Abfrageeffizienz durch Einbeziehung verwandter Entitäten und Anwendung bedingter Filter verbessert. --- .../Contracts/IProfileObjStateRepository.cs | 3 +++ .../Repositories/ProfileObjStateRepository.cs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/WorkFlow.Infrastructure/Contracts/IProfileObjStateRepository.cs b/WorkFlow.Infrastructure/Contracts/IProfileObjStateRepository.cs index 5cdaa38..95afaa1 100644 --- a/WorkFlow.Infrastructure/Contracts/IProfileObjStateRepository.cs +++ b/WorkFlow.Infrastructure/Contracts/IProfileObjStateRepository.cs @@ -5,5 +5,8 @@ namespace WorkFlow.Infrastructure.Contracts { public interface IProfileObjStateRepository : ICRUDRepository { + Task> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = true, bool withState = true, int? profileId = null, int? objId = null, bool? profileActive = null); + + Task ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, bool withState = true, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null); } } \ No newline at end of file diff --git a/WorkFlow.Infrastructure/Repositories/ProfileObjStateRepository.cs b/WorkFlow.Infrastructure/Repositories/ProfileObjStateRepository.cs index 5d88fe0..6039dd6 100644 --- a/WorkFlow.Infrastructure/Repositories/ProfileObjStateRepository.cs +++ b/WorkFlow.Infrastructure/Repositories/ProfileObjStateRepository.cs @@ -43,5 +43,12 @@ namespace WorkFlow.Infrastructure.Repositories return query; } + + public async Task> ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = true, bool withState = true, int? profileId = null, int? objId = null, bool? profileActive = null) + => await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, withState: withState, profileId: profileId, objId: objId, profileActive: profileActive).ToListAsync(); + + public async Task ReadAsync(bool isReadonly = true, bool withProfile = true, bool withUser = false, bool withState = true, int? usrId = null, string? username = null, int? profileId = null, int? objId = null, bool? profileActive = null) + => await Read(isReadonly: isReadonly, withProfile: withProfile, withUser: withUser, withState: withState, usrId: usrId, username: username, profileId: profileId, objId: objId, profileActive: profileActive) + .FirstOrDefaultAsync(); } } \ No newline at end of file