EF Core Beziehungskonfiguration für Envelope-Entität korrigiert

This commit is contained in:
Developer 02
2024-04-04 13:25:41 +02:00
parent 8de0d70e7b
commit 29ae546d98
29 changed files with 282 additions and 45 deletions

View File

@@ -2,6 +2,7 @@
using DigitalData.UserManager.Infrastructure.Repositories;
using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Infrastructure.Contracts;
using Microsoft.EntityFrameworkCore;
namespace EnvelopeGenerator.Infrastructure.Repositories
{
@@ -10,5 +11,21 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
public EnvelopeRepository(EGDbContext dbContext) : base(dbContext)
{
}
public async Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false)
{
var query = _dbSet.AsQueryable();
if (documents)
query = query.Include(e => e.Documents);
if (receivers)
query = query.Include(e => e.Receivers);
if (history)
query = query.Include(e => e.History);
return await query.ToListAsync();
}
}
}