Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing an N+1 issue with Authors on the packages page.

  • Loading branch information...
commit cfb2db151bb7c9574e4d92c351ca8ce30afa7544 1 parent fbae50f
@jeffhandley jeffhandley authored
View
9 Website/ViewModels/ListPackageItemViewModel.cs
@@ -6,11 +6,16 @@ namespace NuGetGallery
{
public class ListPackageItemViewModel : PackageViewModel
{
- public ListPackageItemViewModel(Package package)
+ public ListPackageItemViewModel(Package package, bool needAuthors = true)
: base(package)
{
Tags = package.Tags != null ? package.Tags.Trim().Split(' ') : null;
- Authors = package.Authors;
+
+ if (needAuthors)
+ {
+ Authors = package.Authors;
+ }
+
Owners = package.PackageRegistration.Owners;
}
public IEnumerable<PackageAuthor> Authors { get; set; }
View
2  Website/ViewModels/PackageListViewModel.cs
@@ -22,7 +22,7 @@ public class PackageListViewModel
items = packages.Skip(pageIndex * pageSize)
.Take(pageSize)
.ToList()
- .Select(pv => new ListPackageItemViewModel(pv));
+ .Select(pv => new ListPackageItemViewModel(pv, needAuthors: false));
}
PageIndex = pageIndex;
PageSize = pageSize;
Please sign in to comment.
Something went wrong with that request. Please try again.