Improved a query (minor)

pull/4003/head
tidusjar 4 years ago
parent 942556ee31
commit 951cc7da1b

@ -22,21 +22,21 @@ namespace Ombi.Store.Repository.Requests
{ {
return await Db.TvRequests.Where(x => x.TvDbId == tvDbId) return await Db.TvRequests.Where(x => x.TvDbId == tvDbId)
.Include(x => x.ChildRequests) .Include(x => x.ChildRequests)
.ThenInclude(x => x.RequestedUser) .ThenInclude(x => x.RequestedUser)
.Include(x => x.ChildRequests) .Include(x => x.ChildRequests)
.ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.SeasonRequests)
.ThenInclude(x => x.Episodes) .ThenInclude(x => x.Episodes)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
public TvRequests GetRequest(int tvDbId) public TvRequests GetRequest(int tvDbId)
{ {
return Db.TvRequests.Where(x => x.TvDbId == tvDbId) return Db.TvRequests.Where(x => x.TvDbId == tvDbId).AsSplitQuery()
.Include(x => x.ChildRequests) .Include(x => x.ChildRequests)
.ThenInclude(x => x.RequestedUser) .ThenInclude(x => x.RequestedUser)
.Include(x => x.ChildRequests) .Include(x => x.ChildRequests)
.ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.SeasonRequests)
.ThenInclude(x => x.Episodes) .ThenInclude(x => x.Episodes)
.FirstOrDefault(); .FirstOrDefault();
} }

Loading…
Cancel
Save