Skip to content

Commit

Permalink
Merge pull request #429 from DFE-Digital/feature/trust-v4-endpoint
Browse files Browse the repository at this point in the history
make all trust queries 'with no tracking'
  • Loading branch information
paullocknimble authored Nov 29, 2023
2 parents 96bd145 + 3065b00 commit 53ce0ca
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ public TrustRepository(MstrContext context) : base(context)

public async Task<Trust?> GetTrustByUkprn(string ukprn, CancellationToken cancellationToken)
{
var trust = await DefaultIncludes()
var trust = await DefaultIncludes().AsNoTracking()
.SingleOrDefaultAsync(x => x.UKPRN == ukprn, cancellationToken).ConfigureAwait(false);

return trust;
}
public async Task<Trust?> GetTrustByCompaniesHouseNumber(string companiesHouseNumber, CancellationToken cancellationToken)
{
var trust = await DefaultIncludes()
var trust = await DefaultIncludes().AsNoTracking()
.SingleOrDefaultAsync(x => x.CompaniesHouseNumber == companiesHouseNumber, cancellationToken).ConfigureAwait(false);

return trust;
}

public async Task<Trust?> GetTrustByTrustReferenceNumber(string trustReferenceNumber, CancellationToken cancellationToken)
{
var trust = await DefaultIncludes()
var trust = await DefaultIncludes().AsNoTracking()
.SingleOrDefaultAsync(x => x.GroupID == trustReferenceNumber, cancellationToken).ConfigureAwait(false);

return trust;
}

public async Task<List<Trust>> GetTrustsByUkprns(string[] ukprns, CancellationToken cancellationToken)
{
var trusts = await DefaultIncludes().Where(x => ukprns.Contains(x.UKPRN)).ToListAsync(cancellationToken).ConfigureAwait(false);
var trusts = await DefaultIncludes().AsNoTracking().Where(x => ukprns.Contains(x.UKPRN)).ToListAsync(cancellationToken).ConfigureAwait(false);

return trusts;
}
Expand Down

0 comments on commit 53ce0ca

Please sign in to comment.