Skip to content

Commit

Permalink
Merge pull request #259 from dwiersmastratasys/patch-1
Browse files Browse the repository at this point in the history
Issue #258 - Improve performance of GetProjectReference in ProjectContentResolver
  • Loading branch information
barteksekula authored Jan 15, 2025
2 parents 6d33d06 + 19291df commit e5027a0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Advanced.CMS.ExternalReviews/ProjectContentResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ public ProjectContentResolver(ProjectRepository projectRepository)

public ContentReference GetProjectReference(ContentReference contentLink, int projectId, string language)
{
var items = _projectRepository.ListItems(projectId);

var item = items.FirstOrDefault(
x => x.ContentLink.ToReferenceWithoutVersion() == contentLink.ToReferenceWithoutVersion()
&& (x.Language?.Name == language)
);
var item = _projectRepository
.GetItems(new[] { contentLink.ToReferenceWithoutVersion() })
.Where(x => x.ProjectID == projectId && x.Language.Name == language)
.FirstOrDefault();
return item?.ContentLink;
}

Expand Down

0 comments on commit e5027a0

Please sign in to comment.