Reduce database calls for Microsoft profile page from 21.056 to 2#10411
Reduce database calls for Microsoft profile page from 21.056 to 2#10411joelverhagen merged 6 commits intoNuGet:devfrom
Conversation
|
This looks great, @ErikEJ! Let me give this a try on our DEV environment. |
|
Would there be some possibility to extract some automatic seed data from this experiment to help later investigations? |
|
@lahma I can share my crude tool implementation in a gist if you are interested - I downloaded 250.000 nuspec files, only imported 2000 of them. |
That would be great if possible, allows us others to learn and experiment 👍🏻 |
|
Thank you for your help on the issue so far! I deployed this to our DEV environment and unfortunately the problem still appears to be happening (my jver account on DEV has a bunch of packages): The problem appears to be a SQL timeout: I looked closer at the code. The paging does not happen on the SQL Server side, due to Additionally, I think we should only do these new Perhaps we should push the paging concern down into a new method on To me it seems like we should add a new method to What do you think? |
|
I think I need better test data!! Wish there was some good way of getting that. |
Good point. I will work on a SQL script that generates seed data for this particular problem. |
|
@ErikEJ, here is a seed script. GitHub Copilot did the heavy lifting 🙂. Go to SET NOCOUNT ON;
BEGIN TRANSACTION;
/*
DELETE FROM [dbo].[PackageTypes];
DELETE FROM [dbo].[PackageFrameworks];
DELETE FROM [dbo].[PackageDependencies];
DELETE FROM [dbo].[Packages];
DELETE FROM [dbo].[PackageRegistrationOwners];
DELETE FROM [dbo].[PackageRegistrations];
DELETE FROM [dbo].[Users];
*/
-- Variables
DECLARE @UserId INT;
-- Table variables to capture OUTPUT
DECLARE @PackageRegistrationKeyTable TABLE ([Key] INT);
DECLARE @PackageKeyTable TABLE ([Key] INT);
-- Seed Users
INSERT INTO [dbo].[Users] (EmailAddress, Username, EmailAllowed, NotifyPackagePushed, IsDeleted, EnableMultiFactorAuthentication, UserStatusKey)
VALUES
('user1@example.com', 'user1', 1, 1, 0, 0, 0),
('user2@example.com', 'user2', 1, 1, 0, 0, 0),
('user3@example.com', 'user3', 1, 1, 0, 0, 0);
-- Loop through each user
DECLARE @UserIndex INT = 1;
WHILE @UserIndex <= 1
BEGIN
-- Get the UserKey for the current user
SELECT @UserId = [Key] FROM [dbo].[Users] WHERE Username = CONCAT('user', @UserIndex);
-- Seed Package Registrations for the user
DECLARE @RegistrationIndex INT = 1;
WHILE @RegistrationIndex <= 5000
BEGIN
-- Insert into PackageRegistrations and capture the generated key
DELETE FROM @PackageRegistrationKeyTable;
INSERT INTO [dbo].[PackageRegistrations] (Id, DownloadCount)
OUTPUT INSERTED.[Key] INTO @PackageRegistrationKeyTable
VALUES (CONCAT('Package', @UserIndex, '_', @RegistrationIndex), 0);
-- Ensure the key is retrieved correctly
DECLARE @PackageRegistrationKey INT;
SELECT TOP 1 @PackageRegistrationKey = [Key] FROM @PackageRegistrationKeyTable;
-- Add ownership in PackageRegistrationOwners
INSERT INTO [dbo].[PackageRegistrationOwners] (PackageRegistrationKey, UserKey)
VALUES (@PackageRegistrationKey, @UserId);
-- Seed Packages for the current Package Registration
DECLARE @PackageIndex INT = 1;
WHILE @PackageIndex <= 20
BEGIN
-- Insert into Packages and capture the generated key
DELETE FROM @PackageKeyTable;
INSERT INTO [dbo].[Packages] (PackageRegistrationKey, Version, NormalizedVersion, Listed, IsLatest, IsLatestStable, DownloadCount, Hash, PackageFileSize, RequiresLicenseAcceptance, [Description])
OUTPUT INSERTED.[Key] INTO @PackageKeyTable
VALUES (@PackageRegistrationKey, CONCAT('1.0.', @PackageIndex), CONCAT('1.0.', @PackageIndex), 1, CASE WHEN @PackageIndex = 20 THEN 1 ELSE 0 END, CASE WHEN @PackageIndex = 20 THEN 1 ELSE 0 END, 0, 'dummyhash', 1, 0, 'Dummy description for package.');
-- Ensure the key is retrieved correctly
DECLARE @PackageKey INT;
SELECT TOP 1 @PackageKey = [Key] FROM @PackageKeyTable;
-- Validate that @PackageKey is not NULL
IF @PackageKey IS NOT NULL
BEGIN
-- Seed Dependencies for the current Package
INSERT INTO [dbo].[PackageDependencies] (PackageKey, Id, VersionSpec, TargetFramework)
VALUES (@PackageKey, CONCAT('Dependency', @PackageIndex), '[1.0.0, )', 'net6.0');
-- Seed Frameworks for the current Package
INSERT INTO [dbo].[PackageFrameworks] (Package_Key, TargetFramework)
VALUES (@PackageKey, 'net6.0'),
(@PackageKey, 'net472'),
(@PackageKey, 'net80');
-- Seed Package Types for the current Package
INSERT INTO [dbo].[PackageTypes] (PackageKey, Name, Version)
VALUES (@PackageKey, 'Dependency', NULL);
END
SET @PackageIndex = @PackageIndex + 1;
END
SET @RegistrationIndex = @RegistrationIndex + 1;
END
SET @UserIndex = @UserIndex + 1;
END
SET NOCOUNT OFF;
COMMIT TRANSACTION; |
|
The script runs in about 1m on my machine. You can change the loop conditions to add more users, package registrations, or package versions. |
|
Thanks a lot. Now I can improve my EF Core based seeding. Been thinking it over, and will follow your suggestion with a new targeted method with paging. |
Use seperate query to get totals. use paging
|
@joelverhagen Updated PR, with now 2 database round trips per page view (still better than 21.056 😄 ) - with database query paging... works on my PC for user1 with 5000 packages. |
I found a way to reproduce the issue but a bit complicated. I used nuget-mirror command to download thousands of nuget packages from nuget.org. And then upload some of them to the local environment. This can help create a profile with thousands of nuget packages similar to the Microsoft account. |
|
I think I can improve the summary query, will give it a try tomorrow. |
|
This is looking way better than our current implementation. I am shocked and horrified that we were materializing the whole result set... |
|
I'm looking into the GetPackagesForOwners method. Why does it return all the packages of the owner with Returning 10000+ packages with IEnumerable is not only slow but also consuming memory |
This is an existing method. If we move to a paging or SQL-based-summary approach, we would need to modify the call sites. I think the scope of this PR (focusing on just one, impactful page) is good as-is. |
|
These UTs are failing: |
|
I tested with 3 users on our DEV environment.
There appears to be a minor performance regression for users with very few packages (probably due to the additional round trip, for the summary query), but other users are much, much better. Let's ship it, once the tests are fixed up. |
|
If you want to do the index addition as part of this PR, you are welcome. But if you don't want to, the change seems just fine without the index. We don't have to fix all the problems at once here. I'll leave it up to you. |
|
@joelverhagen I will try to add the index in a new migration... |
|
@joelverhagen All comments should be addressed now. |
It appears the index regresses performance. I think we should drop the index, and then merge the PR. |
|
Cool. You have better test data than I do. |
|
@joelverhagen Index reverted |
|
This is awesome @ErikEJ, thank you so much! I'll get this merged and track the deployment to PROD. |
|
@joelverhagen great, and thanks for your help and review. |
|
Unfortunately, this caused a performance regression in the Profiles page in PROD. I have not yet investigated the reason. The PR will be reverted with #10433 and I will investigate the root cause. |
|
@ErikEJ, it looks like the 2nd query (not the summary query) is the hard hitter. The biggest portion of the query plan is fetching the frameworks, but there are two uses of the Package PK index (one seek, one scan, kind of strange). This is the breakdown for the 2nd query, against the Microsoft org (biggest org on nuget.org). Query 1: takes 2 seconds, returns 1 row. There are 10,542 package registrations counted by this query for Microsoft.Query plan: query-1-plan.zip (@p__linq__0 int)SELECT
[Limit1].[C1] AS [C1],
[Limit1].[C2] AS [C2],
[Limit1].[C3] AS [C3]
FROM ( SELECT TOP (1)
[Project5].[C1] AS [C1],
[Project5].[C2] AS [C2],
[Project5].[C3] AS [C3]
FROM ( SELECT
[Project2].[C1] AS [C1],
[Project2].[C2] AS [C2],
(SELECT
SUM([Project4].[DownloadCount]) AS [A1]
FROM ( SELECT
[Extent4].[Key] AS [Key],
[Extent4].[DownloadCount] AS [DownloadCount],
[Extent3].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM [dbo].[Packages] AS [Extent3]
INNER JOIN [dbo].[PackageRegistrations] AS [Extent4] ON [Extent3].[PackageRegistrationKey] = [Extent4].[Key]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent5]
WHERE ([Extent3].[PackageRegistrationKey] = [Extent5].[PackageRegistrationKey]) AND ([Extent5].[UserKey] = @p__linq__0)
)) AND ([Extent3].[IsLatestSemVer2] = 1) AND ([Project2].[C1] = 1)
) AS [Project4]) AS [C3]
FROM ( SELECT
@p__linq__0 AS [p__linq__0],
[GroupBy1].[K1] AS [C1],
[GroupBy1].[A1] AS [C2]
FROM ( SELECT
[Filter2].[K1] AS [K1],
SUM([Filter2].[A1_0]) AS [A1]
FROM ( SELECT
1 AS [K1],
1 AS [A1_0]
FROM [dbo].[Packages] AS [Extent1]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent2]
WHERE ([Extent1].[PackageRegistrationKey] = [Extent2].[PackageRegistrationKey]) AND ([Extent2].[UserKey] = @p__linq__0)
)) AND ([Extent1].[IsLatestSemVer2] = 1)
) AS [Filter2]
GROUP BY [K1]
) AS [GroupBy1]
) AS [Project2]
) AS [Project5]
) AS [Limit1]Query 2: takes 101 seconds, returns 7021 rows for Microsoft, although 35s of the 101s appear to be streaming results to my client.Query 2 plan: query-2-plan.zip (@p__linq__0 int)SELECT
[UnionAll3].[PackageRegistrationKey] AS [C1],
[UnionAll3].[Key] AS [C2],
[UnionAll3].[Key1] AS [C3],
[UnionAll3].[PackageRegistrationKey1] AS [C4],
[UnionAll3].[Key2] AS [C5],
[UnionAll3].[PackageRegistrationKey2] AS [C6],
[UnionAll3].[Copyright] AS [C7],
[UnionAll3].[Created] AS [C8],
[UnionAll3].[Description] AS [C9],
[UnionAll3].[ReleaseNotes] AS [C10],
[UnionAll3].[DownloadCount1] AS [C11],
[UnionAll3].[ExternalPackageUrl] AS [C12],
[UnionAll3].[HashAlgorithm] AS [C13],
[UnionAll3].[Hash] AS [C14],
[UnionAll3].[IconUrl] AS [C15],
[UnionAll3].[IsLatest] AS [C16],
[UnionAll3].[IsLatestStable] AS [C17],
[UnionAll3].[IsLatestSemVer2] AS [C18],
[UnionAll3].[IsLatestStableSemVer2] AS [C19],
[UnionAll3].[LastUpdated] AS [C20],
[UnionAll3].[LastEdited] AS [C21],
[UnionAll3].[LicenseUrl] AS [C22],
[UnionAll3].[HideLicenseReport] AS [C23],
[UnionAll3].[Language] AS [C24],
[UnionAll3].[Published] AS [C25],
[UnionAll3].[PackageFileSize] AS [C26],
[UnionAll3].[ProjectUrl] AS [C27],
[UnionAll3].[RepositoryUrl] AS [C28],
[UnionAll3].[RepositoryType] AS [C29],
[UnionAll3].[HasReadMe] AS [C30],
[UnionAll3].[RequiresLicenseAcceptance] AS [C31],
[UnionAll3].[DevelopmentDependency] AS [C32],
[UnionAll3].[Summary] AS [C33],
[UnionAll3].[Tags] AS [C34],
[UnionAll3].[Title] AS [C35],
[UnionAll3].[Version] AS [C36],
[UnionAll3].[NormalizedVersion] AS [C37],
[UnionAll3].[SemVerLevelKey] AS [C38],
[UnionAll3].[LicenseNames] AS [C39],
[UnionAll3].[LicenseReportUrl] AS [C40],
[UnionAll3].[Listed] AS [C41],
[UnionAll3].[IsPrerelease] AS [C42],
[UnionAll3].[FlattenedAuthors] AS [C43],
[UnionAll3].[FlattenedDependencies] AS [C44],
[UnionAll3].[FlattenedPackageTypes] AS [C45],
[UnionAll3].[MinClientVersion] AS [C46],
[UnionAll3].[UserKey] AS [C47],
[UnionAll3].[Deleted] AS [C48],
[UnionAll3].[PackageStatusKey] AS [C49],
[UnionAll3].[CertificateKey] AS [C50],
[UnionAll3].[Id1] AS [C51],
[UnionAll3].[EmbeddedLicenseType] AS [C52],
[UnionAll3].[LicenseExpression] AS [C53],
[UnionAll3].[HasEmbeddedIcon] AS [C54],
[UnionAll3].[EmbeddedReadmeType] AS [C55],
[UnionAll3].[PackageRegistrationKey3] AS [C56],
[UnionAll3].[Key3] AS [C57],
[UnionAll3].[Id2] AS [C58],
[UnionAll3].[DownloadCount2] AS [C59],
[UnionAll3].[IsVerified] AS [C60],
[UnionAll3].[IsLocked] AS [C61],
[UnionAll3].[RenamedMessage] AS [C62],
[UnionAll3].[PackageDelete_Key] AS [C63],
[UnionAll3].[C1] AS [C64],
[UnionAll3].[C2] AS [C65],
[UnionAll3].[Key4] AS [C66],
[UnionAll3].[EmailAddress] AS [C67],
[UnionAll3].[UnconfirmedEmailAddress] AS [C68],
[UnionAll3].[Username] AS [C69],
[UnionAll3].[EmailAllowed] AS [C70],
[UnionAll3].[IsDeleted] AS [C71],
[UnionAll3].[EnableMultiFactorAuthentication] AS [C72],
[UnionAll3].[NotifyPackagePushed] AS [C73],
[UnionAll3].[EmailConfirmationToken] AS [C74],
[UnionAll3].[PasswordResetToken] AS [C75],
[UnionAll3].[PasswordResetTokenExpirationDate] AS [C76],
[UnionAll3].[CreatedUtc] AS [C77],
[UnionAll3].[LastFailedLoginUtc] AS [C78],
[UnionAll3].[FailedLoginCount] AS [C79],
[UnionAll3].[UserStatusKey] AS [C80],
[UnionAll3].[C3] AS [C81],
[UnionAll3].[C4] AS [C82],
[UnionAll3].[C5] AS [C83],
[UnionAll3].[C6] AS [C84],
[UnionAll3].[C7] AS [C85],
[UnionAll3].[C8] AS [C86],
[UnionAll3].[C9] AS [C87],
[UnionAll3].[C10] AS [C88],
[UnionAll3].[C11] AS [C89],
[UnionAll3].[C12] AS [C90],
[UnionAll3].[C13] AS [C91],
[UnionAll3].[C14] AS [C92],
[UnionAll3].[C15] AS [C93],
[UnionAll3].[C16] AS [C94],
[UnionAll3].[C17] AS [C95],
[UnionAll3].[C18] AS [C96],
[UnionAll3].[C19] AS [C97],
[UnionAll3].[C20] AS [C98],
[UnionAll3].[C21] AS [C99],
[UnionAll3].[C22] AS [C100],
[UnionAll3].[C23] AS [C101],
[UnionAll3].[C24] AS [C102],
[UnionAll3].[C25] AS [C103],
[UnionAll3].[C26] AS [C104],
[UnionAll3].[C27] AS [C105],
[UnionAll3].[C28] AS [C106],
[UnionAll3].[C29] AS [C107],
[UnionAll3].[C30] AS [C108],
[UnionAll3].[C31] AS [C109],
[UnionAll3].[C32] AS [C110],
[UnionAll3].[C33] AS [C111],
[UnionAll3].[C34] AS [C112],
[UnionAll3].[C35] AS [C113],
[UnionAll3].[C36] AS [C114],
[UnionAll3].[C37] AS [C115],
[UnionAll3].[C38] AS [C116],
[UnionAll3].[C39] AS [C117],
[UnionAll3].[C40] AS [C118],
[UnionAll3].[C41] AS [C119],
[UnionAll3].[C42] AS [C120],
[UnionAll3].[C43] AS [C121],
[UnionAll3].[C44] AS [C122],
[UnionAll3].[C45] AS [C123],
[UnionAll3].[C46] AS [C124],
[UnionAll3].[C47] AS [C125],
[UnionAll3].[C48] AS [C126],
[UnionAll3].[C49] AS [C127],
[UnionAll3].[C50] AS [C128],
[UnionAll3].[C51] AS [C129],
[UnionAll3].[C52] AS [C130],
[UnionAll3].[C53] AS [C131],
[UnionAll3].[C54] AS [C132],
[UnionAll3].[C55] AS [C133],
[UnionAll3].[C56] AS [C134],
[UnionAll3].[C57] AS [C135],
[UnionAll3].[C58] AS [C136],
[UnionAll3].[C59] AS [C137],
[UnionAll3].[C60] AS [C138],
[UnionAll3].[C61] AS [C139],
[UnionAll3].[C62] AS [C140],
[UnionAll3].[C63] AS [C141],
[UnionAll3].[C64] AS [C142],
[UnionAll3].[C65] AS [C143],
[UnionAll3].[C66] AS [C144],
[UnionAll3].[C67] AS [C145],
[UnionAll3].[C68] AS [C146],
[UnionAll3].[C69] AS [C147],
[UnionAll3].[C70] AS [C148],
[UnionAll3].[C71] AS [C149],
[UnionAll3].[C72] AS [C150],
[UnionAll3].[C73] AS [C151],
[UnionAll3].[C74] AS [C152],
[UnionAll3].[C75] AS [C153],
[UnionAll3].[C76] AS [C154],
[UnionAll3].[C77] AS [C155],
[UnionAll3].[C78] AS [C156],
[UnionAll3].[C79] AS [C157],
[UnionAll3].[C80] AS [C158],
[UnionAll3].[C81] AS [C159],
[UnionAll3].[C82] AS [C160],
[UnionAll3].[C83] AS [C161],
[UnionAll3].[C84] AS [C162],
[UnionAll3].[C85] AS [C163]
FROM (SELECT
CASE WHEN ([Join4].[PackageRegistrationKey] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1],
[Limit2].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Limit2].[Key2] AS [Key],
[Limit2].[DownloadCount] AS [DownloadCount],
[Limit2].[Id] AS [Id],
[Limit2].[Key] AS [Key1],
[Limit2].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit2].[Key2] AS [Key2],
[Limit2].[PackageRegistrationKey1] AS [PackageRegistrationKey2],
[Limit2].[Copyright] AS [Copyright],
[Limit2].[Created] AS [Created],
[Limit2].[Description] AS [Description],
[Limit2].[ReleaseNotes] AS [ReleaseNotes],
[Limit2].[DownloadCount2] AS [DownloadCount1],
[Limit2].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit2].[HashAlgorithm] AS [HashAlgorithm],
[Limit2].[Hash] AS [Hash],
[Limit2].[IconUrl] AS [IconUrl],
[Limit2].[IsLatest] AS [IsLatest],
[Limit2].[IsLatestStable] AS [IsLatestStable],
[Limit2].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit2].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit2].[LastUpdated] AS [LastUpdated],
[Limit2].[LastEdited] AS [LastEdited],
[Limit2].[LicenseUrl] AS [LicenseUrl],
[Limit2].[HideLicenseReport] AS [HideLicenseReport],
[Limit2].[Language] AS [Language],
[Limit2].[Published] AS [Published],
[Limit2].[PackageFileSize] AS [PackageFileSize],
[Limit2].[ProjectUrl] AS [ProjectUrl],
[Limit2].[RepositoryUrl] AS [RepositoryUrl],
[Limit2].[RepositoryType] AS [RepositoryType],
[Limit2].[HasReadMe] AS [HasReadMe],
[Limit2].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit2].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit2].[Summary] AS [Summary],
[Limit2].[Tags] AS [Tags],
[Limit2].[Title] AS [Title],
[Limit2].[Version] AS [Version],
[Limit2].[NormalizedVersion] AS [NormalizedVersion],
[Limit2].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit2].[LicenseNames] AS [LicenseNames],
[Limit2].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit2].[Listed] AS [Listed],
[Limit2].[IsPrerelease] AS [IsPrerelease],
[Limit2].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit2].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit2].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit2].[MinClientVersion] AS [MinClientVersion],
[Limit2].[UserKey] AS [UserKey],
[Limit2].[Deleted] AS [Deleted],
[Limit2].[PackageStatusKey] AS [PackageStatusKey],
[Limit2].[CertificateKey] AS [CertificateKey],
[Limit2].[Id2] AS [Id1],
[Limit2].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit2].[LicenseExpression] AS [LicenseExpression],
[Limit2].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit2].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit2].[PackageRegistrationKey] AS [PackageRegistrationKey3],
[Limit2].[Key1] AS [Key3],
[Limit2].[Id1] AS [Id2],
[Limit2].[DownloadCount1] AS [DownloadCount2],
[Limit2].[IsVerified] AS [IsVerified],
[Limit2].[IsLocked] AS [IsLocked],
[Limit2].[RenamedMessage] AS [RenamedMessage],
[Limit2].[PackageDelete_Key] AS [PackageDelete_Key],
CASE WHEN ([Join4].[PackageRegistrationKey] IS NULL) THEN CAST(NULL AS varchar(1)) WHEN ( NOT (([Join4].[C1] = 1) AND ([Join4].[C1] IS NOT NULL))) THEN '3X' ELSE '3X0X' END AS [C2],
[Join4].[Key3] AS [Key4],
[Join4].[EmailAddress] AS [EmailAddress],
[Join4].[UnconfirmedEmailAddress] AS [UnconfirmedEmailAddress],
[Join4].[Username] AS [Username],
[Join4].[EmailAllowed] AS [EmailAllowed],
[Join4].[IsDeleted] AS [IsDeleted],
[Join4].[EnableMultiFactorAuthentication] AS [EnableMultiFactorAuthentication],
[Join4].[NotifyPackagePushed] AS [NotifyPackagePushed],
[Join4].[EmailConfirmationToken] AS [EmailConfirmationToken],
[Join4].[PasswordResetToken] AS [PasswordResetToken],
[Join4].[PasswordResetTokenExpirationDate] AS [PasswordResetTokenExpirationDate],
[Join4].[CreatedUtc] AS [CreatedUtc],
[Join4].[LastFailedLoginUtc] AS [LastFailedLoginUtc],
[Join4].[FailedLoginCount] AS [FailedLoginCount],
[Join4].[UserStatusKey] AS [UserStatusKey],
CAST(NULL AS varchar(1)) AS [C3],
CAST(NULL AS int) AS [C4],
CAST(NULL AS varchar(1)) AS [C5],
CAST(NULL AS varchar(1)) AS [C6],
CAST(NULL AS varchar(1)) AS [C7],
CAST(NULL AS bit) AS [C8],
CAST(NULL AS bit) AS [C9],
CAST(NULL AS bit) AS [C10],
CAST(NULL AS bit) AS [C11],
CAST(NULL AS varchar(1)) AS [C12],
CAST(NULL AS varchar(1)) AS [C13],
CAST(NULL AS datetime2) AS [C14],
CAST(NULL AS datetime2) AS [C15],
CAST(NULL AS datetime2) AS [C16],
CAST(NULL AS int) AS [C17],
CAST(NULL AS int) AS [C18],
CAST(NULL AS int) AS [C19],
CAST(NULL AS int) AS [C20],
CAST(NULL AS int) AS [C21],
CAST(NULL AS int) AS [C22],
CAST(NULL AS varchar(1)) AS [C23],
CAST(NULL AS datetime2) AS [C24],
CAST(NULL AS varchar(1)) AS [C25],
CAST(NULL AS varchar(1)) AS [C26],
CAST(NULL AS bigint) AS [C27],
CAST(NULL AS varchar(1)) AS [C28],
CAST(NULL AS varchar(1)) AS [C29],
CAST(NULL AS varchar(1)) AS [C30],
CAST(NULL AS varchar(1)) AS [C31],
CAST(NULL AS bit) AS [C32],
CAST(NULL AS bit) AS [C33],
CAST(NULL AS bit) AS [C34],
CAST(NULL AS bit) AS [C35],
CAST(NULL AS datetime2) AS [C36],
CAST(NULL AS datetime2) AS [C37],
CAST(NULL AS varchar(1)) AS [C38],
CAST(NULL AS bit) AS [C39],
CAST(NULL AS varchar(1)) AS [C40],
CAST(NULL AS datetime2) AS [C41],
CAST(NULL AS bigint) AS [C42],
CAST(NULL AS varchar(1)) AS [C43],
CAST(NULL AS varchar(1)) AS [C44],
CAST(NULL AS varchar(1)) AS [C45],
CAST(NULL AS bit) AS [C46],
CAST(NULL AS bit) AS [C47],
CAST(NULL AS bit) AS [C48],
CAST(NULL AS varchar(1)) AS [C49],
CAST(NULL AS varchar(1)) AS [C50],
CAST(NULL AS varchar(1)) AS [C51],
CAST(NULL AS varchar(1)) AS [C52],
CAST(NULL AS varchar(1)) AS [C53],
CAST(NULL AS int) AS [C54],
CAST(NULL AS varchar(1)) AS [C55],
CAST(NULL AS varchar(1)) AS [C56],
CAST(NULL AS bit) AS [C57],
CAST(NULL AS bit) AS [C58],
CAST(NULL AS varchar(1)) AS [C59],
CAST(NULL AS varchar(1)) AS [C60],
CAST(NULL AS varchar(1)) AS [C61],
CAST(NULL AS varchar(1)) AS [C62],
CAST(NULL AS int) AS [C63],
CAST(NULL AS bit) AS [C64],
CAST(NULL AS int) AS [C65],
CAST(NULL AS int) AS [C66],
CAST(NULL AS varchar(1)) AS [C67],
CAST(NULL AS int) AS [C68],
CAST(NULL AS varchar(1)) AS [C69],
CAST(NULL AS bit) AS [C70],
CAST(NULL AS int) AS [C71],
CAST(NULL AS int) AS [C72],
CAST(NULL AS int) AS [C73],
CAST(NULL AS int) AS [C74],
CAST(NULL AS int) AS [C75],
CAST(NULL AS varchar(1)) AS [C76],
CAST(NULL AS int) AS [C77],
CAST(NULL AS int) AS [C78],
CAST(NULL AS int) AS [C79],
CAST(NULL AS int) AS [C80],
CAST(NULL AS int) AS [C81],
CAST(NULL AS int) AS [C82],
CAST(NULL AS int) AS [C83],
CAST(NULL AS datetime2) AS [C84],
CAST(NULL AS varchar(1)) AS [C85]
FROM (SELECT [Project6].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project6].[Key] AS [Key], [Project6].[Id] AS [Id], [Project6].[DownloadCount] AS [DownloadCount], [Project6].[Key1] AS [Key1], [Project6].[Id1] AS [Id1], [Project6].[DownloadCount1] AS [DownloadCount1], [Project6].[IsVerified] AS [IsVerified], [Project6].[IsLocked] AS [IsLocked], [Project6].[RenamedMessage] AS [RenamedMessage], [Project6].[Key2] AS [Key2], [Project6].[PackageRegistrationKey1] AS [PackageRegistrationKey1], [Project6].[Copyright] AS [Copyright], [Project6].[Created] AS [Created], [Project6].[Description] AS [Description], [Project6].[ReleaseNotes] AS [ReleaseNotes], [Project6].[DownloadCount2] AS [DownloadCount2], [Project6].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project6].[HashAlgorithm] AS [HashAlgorithm], [Project6].[Hash] AS [Hash], [Project6].[IconUrl] AS [IconUrl], [Project6].[IsLatest] AS [IsLatest], [Project6].[IsLatestStable] AS [IsLatestStable], [Project6].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project6].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project6].[LastUpdated] AS [LastUpdated], [Project6].[LastEdited] AS [LastEdited], [Project6].[LicenseUrl] AS [LicenseUrl], [Project6].[HideLicenseReport] AS [HideLicenseReport], [Project6].[Language] AS [Language], [Project6].[Published] AS [Published], [Project6].[PackageFileSize] AS [PackageFileSize], [Project6].[ProjectUrl] AS [ProjectUrl], [Project6].[RepositoryUrl] AS [RepositoryUrl], [Project6].[RepositoryType] AS [RepositoryType], [Project6].[HasReadMe] AS [HasReadMe], [Project6].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project6].[DevelopmentDependency] AS [DevelopmentDependency], [Project6].[Summary] AS [Summary], [Project6].[Tags] AS [Tags], [Project6].[Title] AS [Title], [Project6].[Version] AS [Version], [Project6].[NormalizedVersion] AS [NormalizedVersion], [Project6].[SemVerLevelKey] AS [SemVerLevelKey], [Project6].[LicenseNames] AS [LicenseNames], [Project6].[LicenseReportUrl] AS [LicenseReportUrl], [Project6].[Listed] AS [Listed], [Project6].[IsPrerelease] AS [IsPrerelease], [Project6].[FlattenedAuthors] AS [FlattenedAuthors], [Project6].[FlattenedDependencies] AS [FlattenedDependencies], [Project6].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project6].[MinClientVersion] AS [MinClientVersion], [Project6].[UserKey] AS [UserKey], [Project6].[Deleted] AS [Deleted], [Project6].[PackageStatusKey] AS [PackageStatusKey], [Project6].[CertificateKey] AS [CertificateKey], [Project6].[Id2] AS [Id2], [Project6].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project6].[LicenseExpression] AS [LicenseExpression], [Project6].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project6].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project6].[PackageDelete_Key] AS [PackageDelete_Key]
FROM ( SELECT
[Project3].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent5].[Key] AS [Key],
[Extent5].[Id] AS [Id],
[Extent5].[DownloadCount] AS [DownloadCount],
[Extent6].[Key] AS [Key1],
[Extent6].[Id] AS [Id1],
[Extent6].[DownloadCount] AS [DownloadCount1],
[Extent6].[IsVerified] AS [IsVerified],
[Extent6].[IsLocked] AS [IsLocked],
[Extent6].[RenamedMessage] AS [RenamedMessage],
[Limit1].[Key] AS [Key2],
[Limit1].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit1].[Copyright] AS [Copyright],
[Limit1].[Created] AS [Created],
[Limit1].[Description] AS [Description],
[Limit1].[ReleaseNotes] AS [ReleaseNotes],
[Limit1].[DownloadCount] AS [DownloadCount2],
[Limit1].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit1].[HashAlgorithm] AS [HashAlgorithm],
[Limit1].[Hash] AS [Hash],
[Limit1].[IconUrl] AS [IconUrl],
[Limit1].[IsLatest] AS [IsLatest],
[Limit1].[IsLatestStable] AS [IsLatestStable],
[Limit1].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit1].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit1].[LastUpdated] AS [LastUpdated],
[Limit1].[LastEdited] AS [LastEdited],
[Limit1].[LicenseUrl] AS [LicenseUrl],
[Limit1].[HideLicenseReport] AS [HideLicenseReport],
[Limit1].[Language] AS [Language],
[Limit1].[Published] AS [Published],
[Limit1].[PackageFileSize] AS [PackageFileSize],
[Limit1].[ProjectUrl] AS [ProjectUrl],
[Limit1].[RepositoryUrl] AS [RepositoryUrl],
[Limit1].[RepositoryType] AS [RepositoryType],
[Limit1].[HasReadMe] AS [HasReadMe],
[Limit1].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit1].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit1].[Summary] AS [Summary],
[Limit1].[Tags] AS [Tags],
[Limit1].[Title] AS [Title],
[Limit1].[Version] AS [Version],
[Limit1].[NormalizedVersion] AS [NormalizedVersion],
[Limit1].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit1].[LicenseNames] AS [LicenseNames],
[Limit1].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit1].[Listed] AS [Listed],
[Limit1].[IsPrerelease] AS [IsPrerelease],
[Limit1].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit1].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit1].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit1].[MinClientVersion] AS [MinClientVersion],
[Limit1].[UserKey] AS [UserKey],
[Limit1].[Deleted] AS [Deleted],
[Limit1].[PackageStatusKey] AS [PackageStatusKey],
[Limit1].[CertificateKey] AS [CertificateKey],
[Limit1].[Id] AS [Id2],
[Limit1].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit1].[LicenseExpression] AS [LicenseExpression],
[Limit1].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit1].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit1].[PackageDelete_Key] AS [PackageDelete_Key]
FROM (SELECT
@p__linq__0 AS [p__linq__0],
[Distinct1].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM ( SELECT DISTINCT
[Extent1].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM [dbo].[Packages] AS [Extent1]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent2]
WHERE ([Extent1].[PackageRegistrationKey] = [Extent2].[PackageRegistrationKey]) AND ([Extent2].[UserKey] = @p__linq__0)
)) AND ([Extent1].[Listed] = 1) AND (0 = [Extent1].[PackageStatusKey])
) AS [Distinct1] ) AS [Project3]
OUTER APPLY (SELECT TOP (1) [Project5].[Key] AS [Key], [Project5].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project5].[Copyright] AS [Copyright], [Project5].[Created] AS [Created], [Project5].[Description] AS [Description], [Project5].[ReleaseNotes] AS [ReleaseNotes], [Project5].[DownloadCount] AS [DownloadCount], [Project5].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project5].[HashAlgorithm] AS [HashAlgorithm], [Project5].[Hash] AS [Hash], [Project5].[IconUrl] AS [IconUrl], [Project5].[IsLatest] AS [IsLatest], [Project5].[IsLatestStable] AS [IsLatestStable], [Project5].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project5].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project5].[LastUpdated] AS [LastUpdated], [Project5].[LastEdited] AS [LastEdited], [Project5].[LicenseUrl] AS [LicenseUrl], [Project5].[HideLicenseReport] AS [HideLicenseReport], [Project5].[Language] AS [Language], [Project5].[Published] AS [Published], [Project5].[PackageFileSize] AS [PackageFileSize], [Project5].[ProjectUrl] AS [ProjectUrl], [Project5].[RepositoryUrl] AS [RepositoryUrl], [Project5].[RepositoryType] AS [RepositoryType], [Project5].[HasReadMe] AS [HasReadMe], [Project5].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project5].[DevelopmentDependency] AS [DevelopmentDependency], [Project5].[Summary] AS [Summary], [Project5].[Tags] AS [Tags], [Project5].[Title] AS [Title], [Project5].[Version] AS [Version], [Project5].[NormalizedVersion] AS [NormalizedVersion], [Project5].[SemVerLevelKey] AS [SemVerLevelKey], [Project5].[LicenseNames] AS [LicenseNames], [Project5].[LicenseReportUrl] AS [LicenseReportUrl], [Project5].[Listed] AS [Listed], [Project5].[IsPrerelease] AS [IsPrerelease], [Project5].[FlattenedAuthors] AS [FlattenedAuthors], [Project5].[FlattenedDependencies] AS [FlattenedDependencies], [Project5].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project5].[MinClientVersion] AS [MinClientVersion], [Project5].[UserKey] AS [UserKey], [Project5].[Deleted] AS [Deleted], [Project5].[PackageStatusKey] AS [PackageStatusKey], [Project5].[CertificateKey] AS [CertificateKey], [Project5].[Id] AS [Id], [Project5].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project5].[LicenseExpression] AS [LicenseExpression], [Project5].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project5].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project5].[PackageDelete_Key] AS [PackageDelete_Key]
FROM ( SELECT
[Extent3].[Key] AS [Key],
[Extent3].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent3].[Copyright] AS [Copyright],
[Extent3].[Created] AS [Created],
[Extent3].[Description] AS [Description],
[Extent3].[ReleaseNotes] AS [ReleaseNotes],
[Extent3].[DownloadCount] AS [DownloadCount],
[Extent3].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Extent3].[HashAlgorithm] AS [HashAlgorithm],
[Extent3].[Hash] AS [Hash],
[Extent3].[IconUrl] AS [IconUrl],
[Extent3].[IsLatest] AS [IsLatest],
[Extent3].[IsLatestStable] AS [IsLatestStable],
[Extent3].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Extent3].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Extent3].[LastUpdated] AS [LastUpdated],
[Extent3].[LastEdited] AS [LastEdited],
[Extent3].[LicenseUrl] AS [LicenseUrl],
[Extent3].[HideLicenseReport] AS [HideLicenseReport],
[Extent3].[Language] AS [Language],
[Extent3].[Published] AS [Published],
[Extent3].[PackageFileSize] AS [PackageFileSize],
[Extent3].[ProjectUrl] AS [ProjectUrl],
[Extent3].[RepositoryUrl] AS [RepositoryUrl],
[Extent3].[RepositoryType] AS [RepositoryType],
[Extent3].[HasReadMe] AS [HasReadMe],
[Extent3].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Extent3].[DevelopmentDependency] AS [DevelopmentDependency],
[Extent3].[Summary] AS [Summary],
[Extent3].[Tags] AS [Tags],
[Extent3].[Title] AS [Title],
[Extent3].[Version] AS [Version],
[Extent3].[NormalizedVersion] AS [NormalizedVersion],
[Extent3].[SemVerLevelKey] AS [SemVerLevelKey],
[Extent3].[LicenseNames] AS [LicenseNames],
[Extent3].[LicenseReportUrl] AS [LicenseReportUrl],
[Extent3].[Listed] AS [Listed],
[Extent3].[IsPrerelease] AS [IsPrerelease],
[Extent3].[FlattenedAuthors] AS [FlattenedAuthors],
[Extent3].[FlattenedDependencies] AS [FlattenedDependencies],
[Extent3].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Extent3].[MinClientVersion] AS [MinClientVersion],
[Extent3].[UserKey] AS [UserKey],
[Extent3].[Deleted] AS [Deleted],
[Extent3].[PackageStatusKey] AS [PackageStatusKey],
[Extent3].[CertificateKey] AS [CertificateKey],
[Extent3].[Id] AS [Id],
[Extent3].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Extent3].[LicenseExpression] AS [LicenseExpression],
[Extent3].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Extent3].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Extent3].[PackageDelete_Key] AS [PackageDelete_Key]
FROM [dbo].[Packages] AS [Extent3]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent4]
WHERE ([Extent3].[PackageRegistrationKey] = [Extent4].[PackageRegistrationKey]) AND ([Extent4].[UserKey] = @p__linq__0)
)) AND ([Extent3].[Listed] = 1) AND (0 = [Extent3].[PackageStatusKey]) AND ([Project3].[PackageRegistrationKey] = [Extent3].[PackageRegistrationKey])
) AS [Project5]
ORDER BY [Project5].[IsLatestStableSemVer2] DESC, [Project5].[IsLatestStable] DESC, [Project5].[IsLatestSemVer2] DESC, [Project5].[IsLatest] DESC, [Project5].[Listed] DESC, [Project5].[Key] DESC ) AS [Limit1]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent5] ON [Limit1].[PackageRegistrationKey] = [Extent5].[Key]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent6] ON [Limit1].[PackageRegistrationKey] = [Extent6].[Key]
) AS [Project6]
ORDER BY row_number() OVER (ORDER BY [Project6].[DownloadCount] DESC, [Project6].[Id] ASC)
OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit2]
LEFT OUTER JOIN (SELECT [Extent7].[PackageRegistrationKey] AS [PackageRegistrationKey], [Join3].[Key3], [Join3].[EmailAddress], [Join3].[UnconfirmedEmailAddress], [Join3].[Username], [Join3].[EmailAllowed], [Join3].[IsDeleted], [Join3].[EnableMultiFactorAuthentication], [Join3].[NotifyPackagePushed], [Join3].[EmailConfirmationToken], [Join3].[PasswordResetToken], [Join3].[PasswordResetTokenExpirationDate], [Join3].[CreatedUtc], [Join3].[LastFailedLoginUtc], [Join3].[FailedLoginCount], [Join3].[UserStatusKey], [Join3].[C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent7]
INNER JOIN (SELECT [Extent8].[Key] AS [Key3], [Extent8].[EmailAddress] AS [EmailAddress], [Extent8].[UnconfirmedEmailAddress] AS [UnconfirmedEmailAddress], [Extent8].[Username] AS [Username], [Extent8].[EmailAllowed] AS [EmailAllowed], [Extent8].[IsDeleted] AS [IsDeleted], [Extent8].[EnableMultiFactorAuthentication] AS [EnableMultiFactorAuthentication], [Extent8].[NotifyPackagePushed] AS [NotifyPackagePushed], [Extent8].[EmailConfirmationToken] AS [EmailConfirmationToken], [Extent8].[PasswordResetToken] AS [PasswordResetToken], [Extent8].[PasswordResetTokenExpirationDate] AS [PasswordResetTokenExpirationDate], [Extent8].[CreatedUtc] AS [CreatedUtc], [Extent8].[LastFailedLoginUtc] AS [LastFailedLoginUtc], [Extent8].[FailedLoginCount] AS [FailedLoginCount], [Extent8].[UserStatusKey] AS [UserStatusKey], [Project7].[C1] AS [C1]
FROM [dbo].[Users] AS [Extent8]
LEFT OUTER JOIN (SELECT
[Extent9].[Key] AS [Key],
cast(1 as bit) AS [C1]
FROM [dbo].[Organizations] AS [Extent9] ) AS [Project7] ON [Extent8].[Key] = [Project7].[Key] ) AS [Join3] ON [Extent7].[UserKey] = [Join3].[Key3] ) AS [Join4] ON [Limit2].[PackageRegistrationKey1] = [Join4].[PackageRegistrationKey]
UNION ALL
SELECT
2 AS [C1],
[Limit4].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Limit4].[Key] AS [Key],
[Limit4].[DownloadCount1] AS [DownloadCount],
[Limit4].[Id1] AS [Id],
[Limit4].[Key1] AS [Key1],
[Limit4].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit4].[Key] AS [Key2],
[Limit4].[PackageRegistrationKey1] AS [PackageRegistrationKey2],
[Limit4].[Copyright] AS [Copyright],
[Limit4].[Created] AS [Created],
[Limit4].[Description] AS [Description],
[Limit4].[ReleaseNotes] AS [ReleaseNotes],
[Limit4].[DownloadCount] AS [DownloadCount1],
[Limit4].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit4].[HashAlgorithm] AS [HashAlgorithm],
[Limit4].[Hash] AS [Hash],
[Limit4].[IconUrl] AS [IconUrl],
[Limit4].[IsLatest] AS [IsLatest],
[Limit4].[IsLatestStable] AS [IsLatestStable],
[Limit4].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit4].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit4].[LastUpdated] AS [LastUpdated],
[Limit4].[LastEdited] AS [LastEdited],
[Limit4].[LicenseUrl] AS [LicenseUrl],
[Limit4].[HideLicenseReport] AS [HideLicenseReport],
[Limit4].[Language] AS [Language],
[Limit4].[Published] AS [Published],
[Limit4].[PackageFileSize] AS [PackageFileSize],
[Limit4].[ProjectUrl] AS [ProjectUrl],
[Limit4].[RepositoryUrl] AS [RepositoryUrl],
[Limit4].[RepositoryType] AS [RepositoryType],
[Limit4].[HasReadMe] AS [HasReadMe],
[Limit4].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit4].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit4].[Summary] AS [Summary],
[Limit4].[Tags] AS [Tags],
[Limit4].[Title] AS [Title],
[Limit4].[Version] AS [Version],
[Limit4].[NormalizedVersion] AS [NormalizedVersion],
[Limit4].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit4].[LicenseNames] AS [LicenseNames],
[Limit4].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit4].[Listed] AS [Listed],
[Limit4].[IsPrerelease] AS [IsPrerelease],
[Limit4].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit4].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit4].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit4].[MinClientVersion] AS [MinClientVersion],
[Limit4].[UserKey] AS [UserKey],
[Limit4].[Deleted] AS [Deleted],
[Limit4].[PackageStatusKey] AS [PackageStatusKey],
[Limit4].[CertificateKey] AS [CertificateKey],
[Limit4].[Id] AS [Id1],
[Limit4].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit4].[LicenseExpression] AS [LicenseExpression],
[Limit4].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit4].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit4].[PackageRegistrationKey] AS [PackageRegistrationKey3],
[Limit4].[Key2] AS [Key3],
[Limit4].[Id2] AS [Id2],
[Limit4].[DownloadCount2] AS [DownloadCount2],
[Limit4].[IsVerified] AS [IsVerified],
[Limit4].[IsLocked] AS [IsLocked],
[Limit4].[RenamedMessage] AS [RenamedMessage],
[Limit4].[PackageDelete_Key] AS [PackageDelete_Key],
CAST(NULL AS varchar(1)) AS [C2],
CAST(NULL AS int) AS [C3],
CAST(NULL AS varchar(1)) AS [C4],
CAST(NULL AS varchar(1)) AS [C5],
CAST(NULL AS varchar(1)) AS [C6],
CAST(NULL AS bit) AS [C7],
CAST(NULL AS bit) AS [C8],
CAST(NULL AS bit) AS [C9],
CAST(NULL AS bit) AS [C10],
CAST(NULL AS varchar(1)) AS [C11],
CAST(NULL AS varchar(1)) AS [C12],
CAST(NULL AS datetime2) AS [C13],
CAST(NULL AS datetime2) AS [C14],
CAST(NULL AS datetime2) AS [C15],
CAST(NULL AS int) AS [C16],
CAST(NULL AS int) AS [C17],
CASE WHEN ( NOT (([Join9].[C1] = 1) AND ([Join9].[C1] IS NOT NULL))) THEN '3X' ELSE '3X0X' END AS [C18],
[Join9].[Key4] AS [Key4],
[Join9].[EmailAddress] AS [EmailAddress],
[Join9].[UnconfirmedEmailAddress] AS [UnconfirmedEmailAddress],
[Join9].[Username] AS [Username],
[Join9].[EmailAllowed] AS [EmailAllowed],
[Join9].[IsDeleted] AS [IsDeleted],
[Join9].[EnableMultiFactorAuthentication] AS [EnableMultiFactorAuthentication],
[Join9].[NotifyPackagePushed] AS [NotifyPackagePushed],
[Join9].[EmailConfirmationToken] AS [EmailConfirmationToken],
[Join9].[PasswordResetToken] AS [PasswordResetToken],
[Join9].[PasswordResetTokenExpirationDate] AS [PasswordResetTokenExpirationDate],
[Join9].[CreatedUtc] AS [CreatedUtc],
[Join9].[LastFailedLoginUtc] AS [LastFailedLoginUtc],
[Join9].[FailedLoginCount] AS [FailedLoginCount],
[Join9].[UserStatusKey] AS [UserStatusKey],
CAST(NULL AS int) AS [C19],
CAST(NULL AS int) AS [C20],
CAST(NULL AS int) AS [C21],
CAST(NULL AS int) AS [C22],
CAST(NULL AS varchar(1)) AS [C23],
CAST(NULL AS datetime2) AS [C24],
CAST(NULL AS varchar(1)) AS [C25],
CAST(NULL AS varchar(1)) AS [C26],
CAST(NULL AS bigint) AS [C27],
CAST(NULL AS varchar(1)) AS [C28],
CAST(NULL AS varchar(1)) AS [C29],
CAST(NULL AS varchar(1)) AS [C30],
CAST(NULL AS varchar(1)) AS [C31],
CAST(NULL AS bit) AS [C32],
CAST(NULL AS bit) AS [C33],
CAST(NULL AS bit) AS [C34],
CAST(NULL AS bit) AS [C35],
CAST(NULL AS datetime2) AS [C36],
CAST(NULL AS datetime2) AS [C37],
CAST(NULL AS varchar(1)) AS [C38],
CAST(NULL AS bit) AS [C39],
CAST(NULL AS varchar(1)) AS [C40],
CAST(NULL AS datetime2) AS [C41],
CAST(NULL AS bigint) AS [C42],
CAST(NULL AS varchar(1)) AS [C43],
CAST(NULL AS varchar(1)) AS [C44],
CAST(NULL AS varchar(1)) AS [C45],
CAST(NULL AS bit) AS [C46],
CAST(NULL AS bit) AS [C47],
CAST(NULL AS bit) AS [C48],
CAST(NULL AS varchar(1)) AS [C49],
CAST(NULL AS varchar(1)) AS [C50],
CAST(NULL AS varchar(1)) AS [C51],
CAST(NULL AS varchar(1)) AS [C52],
CAST(NULL AS varchar(1)) AS [C53],
CAST(NULL AS int) AS [C54],
CAST(NULL AS varchar(1)) AS [C55],
CAST(NULL AS varchar(1)) AS [C56],
CAST(NULL AS bit) AS [C57],
CAST(NULL AS bit) AS [C58],
CAST(NULL AS varchar(1)) AS [C59],
CAST(NULL AS varchar(1)) AS [C60],
CAST(NULL AS varchar(1)) AS [C61],
CAST(NULL AS varchar(1)) AS [C62],
CAST(NULL AS int) AS [C63],
CAST(NULL AS bit) AS [C64],
CAST(NULL AS int) AS [C65],
CAST(NULL AS int) AS [C66],
CAST(NULL AS varchar(1)) AS [C67],
CAST(NULL AS int) AS [C68],
CAST(NULL AS varchar(1)) AS [C69],
CAST(NULL AS bit) AS [C70],
CAST(NULL AS int) AS [C71],
CAST(NULL AS int) AS [C72],
CAST(NULL AS int) AS [C73],
CAST(NULL AS int) AS [C74],
CAST(NULL AS int) AS [C75],
CAST(NULL AS varchar(1)) AS [C76],
CAST(NULL AS int) AS [C77],
CAST(NULL AS int) AS [C78],
CAST(NULL AS int) AS [C79],
CAST(NULL AS int) AS [C80],
CAST(NULL AS int) AS [C81],
CAST(NULL AS int) AS [C82],
CAST(NULL AS int) AS [C83],
CAST(NULL AS datetime2) AS [C84],
CAST(NULL AS varchar(1)) AS [C85]
FROM (SELECT [Project14].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project14].[Key] AS [Key], [Project14].[PackageRegistrationKey1] AS [PackageRegistrationKey1], [Project14].[Copyright] AS [Copyright], [Project14].[Created] AS [Created], [Project14].[Description] AS [Description], [Project14].[ReleaseNotes] AS [ReleaseNotes], [Project14].[DownloadCount] AS [DownloadCount], [Project14].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project14].[HashAlgorithm] AS [HashAlgorithm], [Project14].[Hash] AS [Hash], [Project14].[IconUrl] AS [IconUrl], [Project14].[IsLatest] AS [IsLatest], [Project14].[IsLatestStable] AS [IsLatestStable], [Project14].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project14].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project14].[LastUpdated] AS [LastUpdated], [Project14].[LastEdited] AS [LastEdited], [Project14].[LicenseUrl] AS [LicenseUrl], [Project14].[HideLicenseReport] AS [HideLicenseReport], [Project14].[Language] AS [Language], [Project14].[Published] AS [Published], [Project14].[PackageFileSize] AS [PackageFileSize], [Project14].[ProjectUrl] AS [ProjectUrl], [Project14].[RepositoryUrl] AS [RepositoryUrl], [Project14].[RepositoryType] AS [RepositoryType], [Project14].[HasReadMe] AS [HasReadMe], [Project14].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project14].[DevelopmentDependency] AS [DevelopmentDependency], [Project14].[Summary] AS [Summary], [Project14].[Tags] AS [Tags], [Project14].[Title] AS [Title], [Project14].[Version] AS [Version], [Project14].[NormalizedVersion] AS [NormalizedVersion], [Project14].[SemVerLevelKey] AS [SemVerLevelKey], [Project14].[LicenseNames] AS [LicenseNames], [Project14].[LicenseReportUrl] AS [LicenseReportUrl], [Project14].[Listed] AS [Listed], [Project14].[IsPrerelease] AS [IsPrerelease], [Project14].[FlattenedAuthors] AS [FlattenedAuthors], [Project14].[FlattenedDependencies] AS [FlattenedDependencies], [Project14].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project14].[MinClientVersion] AS [MinClientVersion], [Project14].[UserKey] AS [UserKey], [Project14].[Deleted] AS [Deleted], [Project14].[PackageStatusKey] AS [PackageStatusKey], [Project14].[CertificateKey] AS [CertificateKey], [Project14].[Id] AS [Id], [Project14].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project14].[LicenseExpression] AS [LicenseExpression], [Project14].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project14].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project14].[PackageDelete_Key] AS [PackageDelete_Key], [Project14].[Key1] AS [Key1], [Project14].[Id1] AS [Id1], [Project14].[DownloadCount1] AS [DownloadCount1], [Project14].[Key2] AS [Key2], [Project14].[Id2] AS [Id2], [Project14].[DownloadCount2] AS [DownloadCount2], [Project14].[IsVerified] AS [IsVerified], [Project14].[IsLocked] AS [IsLocked], [Project14].[RenamedMessage] AS [RenamedMessage]
FROM ( SELECT
[Project11].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Limit3].[Key] AS [Key],
[Limit3].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit3].[Copyright] AS [Copyright],
[Limit3].[Created] AS [Created],
[Limit3].[Description] AS [Description],
[Limit3].[ReleaseNotes] AS [ReleaseNotes],
[Limit3].[DownloadCount] AS [DownloadCount],
[Limit3].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit3].[HashAlgorithm] AS [HashAlgorithm],
[Limit3].[Hash] AS [Hash],
[Limit3].[IconUrl] AS [IconUrl],
[Limit3].[IsLatest] AS [IsLatest],
[Limit3].[IsLatestStable] AS [IsLatestStable],
[Limit3].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit3].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit3].[LastUpdated] AS [LastUpdated],
[Limit3].[LastEdited] AS [LastEdited],
[Limit3].[LicenseUrl] AS [LicenseUrl],
[Limit3].[HideLicenseReport] AS [HideLicenseReport],
[Limit3].[Language] AS [Language],
[Limit3].[Published] AS [Published],
[Limit3].[PackageFileSize] AS [PackageFileSize],
[Limit3].[ProjectUrl] AS [ProjectUrl],
[Limit3].[RepositoryUrl] AS [RepositoryUrl],
[Limit3].[RepositoryType] AS [RepositoryType],
[Limit3].[HasReadMe] AS [HasReadMe],
[Limit3].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit3].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit3].[Summary] AS [Summary],
[Limit3].[Tags] AS [Tags],
[Limit3].[Title] AS [Title],
[Limit3].[Version] AS [Version],
[Limit3].[NormalizedVersion] AS [NormalizedVersion],
[Limit3].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit3].[LicenseNames] AS [LicenseNames],
[Limit3].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit3].[Listed] AS [Listed],
[Limit3].[IsPrerelease] AS [IsPrerelease],
[Limit3].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit3].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit3].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit3].[MinClientVersion] AS [MinClientVersion],
[Limit3].[UserKey] AS [UserKey],
[Limit3].[Deleted] AS [Deleted],
[Limit3].[PackageStatusKey] AS [PackageStatusKey],
[Limit3].[CertificateKey] AS [CertificateKey],
[Limit3].[Id] AS [Id],
[Limit3].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit3].[LicenseExpression] AS [LicenseExpression],
[Limit3].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit3].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit3].[PackageDelete_Key] AS [PackageDelete_Key],
[Extent14].[Key] AS [Key1],
[Extent14].[Id] AS [Id1],
[Extent14].[DownloadCount] AS [DownloadCount1],
[Extent15].[Key] AS [Key2],
[Extent15].[Id] AS [Id2],
[Extent15].[DownloadCount] AS [DownloadCount2],
[Extent15].[IsVerified] AS [IsVerified],
[Extent15].[IsLocked] AS [IsLocked],
[Extent15].[RenamedMessage] AS [RenamedMessage]
FROM (SELECT
@p__linq__0 AS [p__linq__0],
[Distinct2].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM ( SELECT DISTINCT
[Extent10].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM [dbo].[Packages] AS [Extent10]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent11]
WHERE ([Extent10].[PackageRegistrationKey] = [Extent11].[PackageRegistrationKey]) AND ([Extent11].[UserKey] = @p__linq__0)
)) AND ([Extent10].[Listed] = 1) AND (0 = [Extent10].[PackageStatusKey])
) AS [Distinct2] ) AS [Project11]
OUTER APPLY (SELECT TOP (1) [Project13].[Key] AS [Key], [Project13].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project13].[Copyright] AS [Copyright], [Project13].[Created] AS [Created], [Project13].[Description] AS [Description], [Project13].[ReleaseNotes] AS [ReleaseNotes], [Project13].[DownloadCount] AS [DownloadCount], [Project13].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project13].[HashAlgorithm] AS [HashAlgorithm], [Project13].[Hash] AS [Hash], [Project13].[IconUrl] AS [IconUrl], [Project13].[IsLatest] AS [IsLatest], [Project13].[IsLatestStable] AS [IsLatestStable], [Project13].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project13].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project13].[LastUpdated] AS [LastUpdated], [Project13].[LastEdited] AS [LastEdited], [Project13].[LicenseUrl] AS [LicenseUrl], [Project13].[HideLicenseReport] AS [HideLicenseReport], [Project13].[Language] AS [Language], [Project13].[Published] AS [Published], [Project13].[PackageFileSize] AS [PackageFileSize], [Project13].[ProjectUrl] AS [ProjectUrl], [Project13].[RepositoryUrl] AS [RepositoryUrl], [Project13].[RepositoryType] AS [RepositoryType], [Project13].[HasReadMe] AS [HasReadMe], [Project13].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project13].[DevelopmentDependency] AS [DevelopmentDependency], [Project13].[Summary] AS [Summary], [Project13].[Tags] AS [Tags], [Project13].[Title] AS [Title], [Project13].[Version] AS [Version], [Project13].[NormalizedVersion] AS [NormalizedVersion], [Project13].[SemVerLevelKey] AS [SemVerLevelKey], [Project13].[LicenseNames] AS [LicenseNames], [Project13].[LicenseReportUrl] AS [LicenseReportUrl], [Project13].[Listed] AS [Listed], [Project13].[IsPrerelease] AS [IsPrerelease], [Project13].[FlattenedAuthors] AS [FlattenedAuthors], [Project13].[FlattenedDependencies] AS [FlattenedDependencies], [Project13].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project13].[MinClientVersion] AS [MinClientVersion], [Project13].[UserKey] AS [UserKey], [Project13].[Deleted] AS [Deleted], [Project13].[PackageStatusKey] AS [PackageStatusKey], [Project13].[CertificateKey] AS [CertificateKey], [Project13].[Id] AS [Id], [Project13].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project13].[LicenseExpression] AS [LicenseExpression], [Project13].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project13].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project13].[PackageDelete_Key] AS [PackageDelete_Key]
FROM ( SELECT
[Extent12].[Key] AS [Key],
[Extent12].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent12].[Copyright] AS [Copyright],
[Extent12].[Created] AS [Created],
[Extent12].[Description] AS [Description],
[Extent12].[ReleaseNotes] AS [ReleaseNotes],
[Extent12].[DownloadCount] AS [DownloadCount],
[Extent12].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Extent12].[HashAlgorithm] AS [HashAlgorithm],
[Extent12].[Hash] AS [Hash],
[Extent12].[IconUrl] AS [IconUrl],
[Extent12].[IsLatest] AS [IsLatest],
[Extent12].[IsLatestStable] AS [IsLatestStable],
[Extent12].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Extent12].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Extent12].[LastUpdated] AS [LastUpdated],
[Extent12].[LastEdited] AS [LastEdited],
[Extent12].[LicenseUrl] AS [LicenseUrl],
[Extent12].[HideLicenseReport] AS [HideLicenseReport],
[Extent12].[Language] AS [Language],
[Extent12].[Published] AS [Published],
[Extent12].[PackageFileSize] AS [PackageFileSize],
[Extent12].[ProjectUrl] AS [ProjectUrl],
[Extent12].[RepositoryUrl] AS [RepositoryUrl],
[Extent12].[RepositoryType] AS [RepositoryType],
[Extent12].[HasReadMe] AS [HasReadMe],
[Extent12].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Extent12].[DevelopmentDependency] AS [DevelopmentDependency],
[Extent12].[Summary] AS [Summary],
[Extent12].[Tags] AS [Tags],
[Extent12].[Title] AS [Title],
[Extent12].[Version] AS [Version],
[Extent12].[NormalizedVersion] AS [NormalizedVersion],
[Extent12].[SemVerLevelKey] AS [SemVerLevelKey],
[Extent12].[LicenseNames] AS [LicenseNames],
[Extent12].[LicenseReportUrl] AS [LicenseReportUrl],
[Extent12].[Listed] AS [Listed],
[Extent12].[IsPrerelease] AS [IsPrerelease],
[Extent12].[FlattenedAuthors] AS [FlattenedAuthors],
[Extent12].[FlattenedDependencies] AS [FlattenedDependencies],
[Extent12].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Extent12].[MinClientVersion] AS [MinClientVersion],
[Extent12].[UserKey] AS [UserKey],
[Extent12].[Deleted] AS [Deleted],
[Extent12].[PackageStatusKey] AS [PackageStatusKey],
[Extent12].[CertificateKey] AS [CertificateKey],
[Extent12].[Id] AS [Id],
[Extent12].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Extent12].[LicenseExpression] AS [LicenseExpression],
[Extent12].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Extent12].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Extent12].[PackageDelete_Key] AS [PackageDelete_Key]
FROM [dbo].[Packages] AS [Extent12]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent13]
WHERE ([Extent12].[PackageRegistrationKey] = [Extent13].[PackageRegistrationKey]) AND ([Extent13].[UserKey] = @p__linq__0)
)) AND ([Extent12].[Listed] = 1) AND (0 = [Extent12].[PackageStatusKey]) AND ([Project11].[PackageRegistrationKey] = [Extent12].[PackageRegistrationKey])
) AS [Project13]
ORDER BY [Project13].[IsLatestStableSemVer2] DESC, [Project13].[IsLatestStable] DESC, [Project13].[IsLatestSemVer2] DESC, [Project13].[IsLatest] DESC, [Project13].[Listed] DESC, [Project13].[Key] DESC ) AS [Limit3]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent14] ON [Limit3].[PackageRegistrationKey] = [Extent14].[Key]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent15] ON [Limit3].[PackageRegistrationKey] = [Extent15].[Key]
) AS [Project14]
ORDER BY row_number() OVER (ORDER BY [Project14].[DownloadCount1] DESC, [Project14].[Id1] ASC)
OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit4]
INNER JOIN (SELECT [Extent16].[PackageRegistrationKey] AS [PackageRegistrationKey], [Join8].[Key4], [Join8].[EmailAddress], [Join8].[UnconfirmedEmailAddress], [Join8].[Username], [Join8].[EmailAllowed], [Join8].[IsDeleted], [Join8].[EnableMultiFactorAuthentication], [Join8].[NotifyPackagePushed], [Join8].[EmailConfirmationToken], [Join8].[PasswordResetToken], [Join8].[PasswordResetTokenExpirationDate], [Join8].[CreatedUtc], [Join8].[LastFailedLoginUtc], [Join8].[FailedLoginCount], [Join8].[UserStatusKey], [Join8].[C1]
FROM [dbo].[PackageRegistrationRequiredSigners] AS [Extent16]
INNER JOIN (SELECT [Extent17].[Key] AS [Key4], [Extent17].[EmailAddress] AS [EmailAddress], [Extent17].[UnconfirmedEmailAddress] AS [UnconfirmedEmailAddress], [Extent17].[Username] AS [Username], [Extent17].[EmailAllowed] AS [EmailAllowed], [Extent17].[IsDeleted] AS [IsDeleted], [Extent17].[EnableMultiFactorAuthentication] AS [EnableMultiFactorAuthentication], [Extent17].[NotifyPackagePushed] AS [NotifyPackagePushed], [Extent17].[EmailConfirmationToken] AS [EmailConfirmationToken], [Extent17].[PasswordResetToken] AS [PasswordResetToken], [Extent17].[PasswordResetTokenExpirationDate] AS [PasswordResetTokenExpirationDate], [Extent17].[CreatedUtc] AS [CreatedUtc], [Extent17].[LastFailedLoginUtc] AS [LastFailedLoginUtc], [Extent17].[FailedLoginCount] AS [FailedLoginCount], [Extent17].[UserStatusKey] AS [UserStatusKey], [Project15].[C1] AS [C1]
FROM [dbo].[Users] AS [Extent17]
LEFT OUTER JOIN (SELECT
[Extent18].[Key] AS [Key],
cast(1 as bit) AS [C1]
FROM [dbo].[Organizations] AS [Extent18] ) AS [Project15] ON [Extent17].[Key] = [Project15].[Key] ) AS [Join8] ON [Extent16].[UserKey] = [Join8].[Key4] ) AS [Join9] ON [Limit4].[PackageRegistrationKey1] = [Join9].[PackageRegistrationKey]
UNION ALL
SELECT
3 AS [C1],
[Limit6].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Limit6].[Key] AS [Key],
[Limit6].[DownloadCount1] AS [DownloadCount],
[Limit6].[Id1] AS [Id],
[Limit6].[Key1] AS [Key1],
[Limit6].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit6].[Key] AS [Key2],
[Limit6].[PackageRegistrationKey1] AS [PackageRegistrationKey2],
[Limit6].[Copyright] AS [Copyright],
[Limit6].[Created] AS [Created],
[Limit6].[Description] AS [Description],
[Limit6].[ReleaseNotes] AS [ReleaseNotes],
[Limit6].[DownloadCount] AS [DownloadCount1],
[Limit6].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit6].[HashAlgorithm] AS [HashAlgorithm],
[Limit6].[Hash] AS [Hash],
[Limit6].[IconUrl] AS [IconUrl],
[Limit6].[IsLatest] AS [IsLatest],
[Limit6].[IsLatestStable] AS [IsLatestStable],
[Limit6].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit6].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit6].[LastUpdated] AS [LastUpdated],
[Limit6].[LastEdited] AS [LastEdited],
[Limit6].[LicenseUrl] AS [LicenseUrl],
[Limit6].[HideLicenseReport] AS [HideLicenseReport],
[Limit6].[Language] AS [Language],
[Limit6].[Published] AS [Published],
[Limit6].[PackageFileSize] AS [PackageFileSize],
[Limit6].[ProjectUrl] AS [ProjectUrl],
[Limit6].[RepositoryUrl] AS [RepositoryUrl],
[Limit6].[RepositoryType] AS [RepositoryType],
[Limit6].[HasReadMe] AS [HasReadMe],
[Limit6].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit6].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit6].[Summary] AS [Summary],
[Limit6].[Tags] AS [Tags],
[Limit6].[Title] AS [Title],
[Limit6].[Version] AS [Version],
[Limit6].[NormalizedVersion] AS [NormalizedVersion],
[Limit6].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit6].[LicenseNames] AS [LicenseNames],
[Limit6].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit6].[Listed] AS [Listed],
[Limit6].[IsPrerelease] AS [IsPrerelease],
[Limit6].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit6].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit6].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit6].[MinClientVersion] AS [MinClientVersion],
[Limit6].[UserKey] AS [UserKey],
[Limit6].[Deleted] AS [Deleted],
[Limit6].[PackageStatusKey] AS [PackageStatusKey],
[Limit6].[CertificateKey] AS [CertificateKey],
[Limit6].[Id] AS [Id1],
[Limit6].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit6].[LicenseExpression] AS [LicenseExpression],
[Limit6].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit6].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit6].[PackageRegistrationKey] AS [PackageRegistrationKey3],
[Limit6].[Key2] AS [Key3],
[Limit6].[Id2] AS [Id2],
[Limit6].[DownloadCount2] AS [DownloadCount2],
[Limit6].[IsVerified] AS [IsVerified],
[Limit6].[IsLocked] AS [IsLocked],
[Limit6].[RenamedMessage] AS [RenamedMessage],
[Limit6].[PackageDelete_Key] AS [PackageDelete_Key],
CAST(NULL AS varchar(1)) AS [C2],
CAST(NULL AS int) AS [C3],
CAST(NULL AS varchar(1)) AS [C4],
CAST(NULL AS varchar(1)) AS [C5],
CAST(NULL AS varchar(1)) AS [C6],
CAST(NULL AS bit) AS [C7],
CAST(NULL AS bit) AS [C8],
CAST(NULL AS bit) AS [C9],
CAST(NULL AS bit) AS [C10],
CAST(NULL AS varchar(1)) AS [C11],
CAST(NULL AS varchar(1)) AS [C12],
CAST(NULL AS datetime2) AS [C13],
CAST(NULL AS datetime2) AS [C14],
CAST(NULL AS datetime2) AS [C15],
CAST(NULL AS int) AS [C16],
CAST(NULL AS int) AS [C17],
CAST(NULL AS varchar(1)) AS [C18],
CAST(NULL AS int) AS [C19],
CAST(NULL AS varchar(1)) AS [C20],
CAST(NULL AS varchar(1)) AS [C21],
CAST(NULL AS varchar(1)) AS [C22],
CAST(NULL AS bit) AS [C23],
CAST(NULL AS bit) AS [C24],
CAST(NULL AS bit) AS [C25],
CAST(NULL AS bit) AS [C26],
CAST(NULL AS varchar(1)) AS [C27],
CAST(NULL AS varchar(1)) AS [C28],
CAST(NULL AS datetime2) AS [C29],
CAST(NULL AS datetime2) AS [C30],
CAST(NULL AS datetime2) AS [C31],
CAST(NULL AS int) AS [C32],
CAST(NULL AS int) AS [C33],
[UnionAll2].[PackageRegistrationKey] AS [C34],
[UnionAll2].[Key] AS [C35],
[UnionAll2].[Key1] AS [C36],
[UnionAll2].[PackageRegistrationKey1] AS [C37],
[UnionAll2].[Copyright] AS [C38],
[UnionAll2].[Created] AS [C39],
[UnionAll2].[Description] AS [C40],
[UnionAll2].[ReleaseNotes] AS [C41],
[UnionAll2].[DownloadCount] AS [C42],
[UnionAll2].[ExternalPackageUrl] AS [C43],
[UnionAll2].[HashAlgorithm] AS [C44],
[UnionAll2].[Hash] AS [C45],
[UnionAll2].[IconUrl] AS [C46],
[UnionAll2].[IsLatest] AS [C47],
[UnionAll2].[IsLatestStable] AS [C48],
[UnionAll2].[IsLatestSemVer2] AS [C49],
[UnionAll2].[IsLatestStableSemVer2] AS [C50],
[UnionAll2].[LastUpdated] AS [C51],
[UnionAll2].[LastEdited] AS [C52],
[UnionAll2].[LicenseUrl] AS [C53],
[UnionAll2].[HideLicenseReport] AS [C54],
[UnionAll2].[Language] AS [C55],
[UnionAll2].[Published] AS [C56],
[UnionAll2].[PackageFileSize] AS [C57],
[UnionAll2].[ProjectUrl] AS [C58],
[UnionAll2].[RepositoryUrl] AS [C59],
[UnionAll2].[RepositoryType] AS [C60],
[UnionAll2].[HasReadMe] AS [C61],
[UnionAll2].[RequiresLicenseAcceptance] AS [C62],
[UnionAll2].[DevelopmentDependency] AS [C63],
[UnionAll2].[Summary] AS [C64],
[UnionAll2].[Tags] AS [C65],
[UnionAll2].[Title] AS [C66],
[UnionAll2].[Version] AS [C67],
[UnionAll2].[NormalizedVersion] AS [C68],
[UnionAll2].[SemVerLevelKey] AS [C69],
[UnionAll2].[LicenseNames] AS [C70],
[UnionAll2].[LicenseReportUrl] AS [C71],
[UnionAll2].[Listed] AS [C72],
[UnionAll2].[IsPrerelease] AS [C73],
[UnionAll2].[FlattenedAuthors] AS [C74],
[UnionAll2].[FlattenedDependencies] AS [C75],
[UnionAll2].[FlattenedPackageTypes] AS [C76],
[UnionAll2].[MinClientVersion] AS [C77],
[UnionAll2].[UserKey] AS [C78],
[UnionAll2].[Deleted] AS [C79],
[UnionAll2].[PackageStatusKey] AS [C80],
[UnionAll2].[CertificateKey] AS [C81],
[UnionAll2].[Id] AS [C82],
[UnionAll2].[EmbeddedLicenseType] AS [C83],
[UnionAll2].[LicenseExpression] AS [C84],
[UnionAll2].[HasEmbeddedIcon] AS [C85],
[UnionAll2].[EmbeddedReadmeType] AS [C86],
[UnionAll2].[PackageDelete_Key] AS [C87],
[UnionAll2].[C1] AS [C88],
[UnionAll2].[Key2] AS [C89],
[UnionAll2].[Key3] AS [C90],
[UnionAll2].[TargetFramework] AS [C91],
[UnionAll2].[Package_Key] AS [C92],
[UnionAll2].[C2] AS [C93],
[UnionAll2].[C3] AS [C94],
[UnionAll2].[C4] AS [C95],
[UnionAll2].[C5] AS [C96],
[UnionAll2].[C6] AS [C97],
[UnionAll2].[C7] AS [C98],
[UnionAll2].[C8] AS [C99],
[UnionAll2].[C9] AS [C100]
FROM (SELECT [Project22].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project22].[Key] AS [Key], [Project22].[PackageRegistrationKey1] AS [PackageRegistrationKey1], [Project22].[Copyright] AS [Copyright], [Project22].[Created] AS [Created], [Project22].[Description] AS [Description], [Project22].[ReleaseNotes] AS [ReleaseNotes], [Project22].[DownloadCount] AS [DownloadCount], [Project22].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project22].[HashAlgorithm] AS [HashAlgorithm], [Project22].[Hash] AS [Hash], [Project22].[IconUrl] AS [IconUrl], [Project22].[IsLatest] AS [IsLatest], [Project22].[IsLatestStable] AS [IsLatestStable], [Project22].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project22].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project22].[LastUpdated] AS [LastUpdated], [Project22].[LastEdited] AS [LastEdited], [Project22].[LicenseUrl] AS [LicenseUrl], [Project22].[HideLicenseReport] AS [HideLicenseReport], [Project22].[Language] AS [Language], [Project22].[Published] AS [Published], [Project22].[PackageFileSize] AS [PackageFileSize], [Project22].[ProjectUrl] AS [ProjectUrl], [Project22].[RepositoryUrl] AS [RepositoryUrl], [Project22].[RepositoryType] AS [RepositoryType], [Project22].[HasReadMe] AS [HasReadMe], [Project22].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project22].[DevelopmentDependency] AS [DevelopmentDependency], [Project22].[Summary] AS [Summary], [Project22].[Tags] AS [Tags], [Project22].[Title] AS [Title], [Project22].[Version] AS [Version], [Project22].[NormalizedVersion] AS [NormalizedVersion], [Project22].[SemVerLevelKey] AS [SemVerLevelKey], [Project22].[LicenseNames] AS [LicenseNames], [Project22].[LicenseReportUrl] AS [LicenseReportUrl], [Project22].[Listed] AS [Listed], [Project22].[IsPrerelease] AS [IsPrerelease], [Project22].[FlattenedAuthors] AS [FlattenedAuthors], [Project22].[FlattenedDependencies] AS [FlattenedDependencies], [Project22].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project22].[MinClientVersion] AS [MinClientVersion], [Project22].[UserKey] AS [UserKey], [Project22].[Deleted] AS [Deleted], [Project22].[PackageStatusKey] AS [PackageStatusKey], [Project22].[CertificateKey] AS [CertificateKey], [Project22].[Id] AS [Id], [Project22].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project22].[LicenseExpression] AS [LicenseExpression], [Project22].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project22].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project22].[PackageDelete_Key] AS [PackageDelete_Key], [Project22].[Key1] AS [Key1], [Project22].[Id1] AS [Id1], [Project22].[DownloadCount1] AS [DownloadCount1], [Project22].[Key2] AS [Key2], [Project22].[Id2] AS [Id2], [Project22].[DownloadCount2] AS [DownloadCount2], [Project22].[IsVerified] AS [IsVerified], [Project22].[IsLocked] AS [IsLocked], [Project22].[RenamedMessage] AS [RenamedMessage]
FROM ( SELECT
[Project19].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Limit5].[Key] AS [Key],
[Limit5].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Limit5].[Copyright] AS [Copyright],
[Limit5].[Created] AS [Created],
[Limit5].[Description] AS [Description],
[Limit5].[ReleaseNotes] AS [ReleaseNotes],
[Limit5].[DownloadCount] AS [DownloadCount],
[Limit5].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Limit5].[HashAlgorithm] AS [HashAlgorithm],
[Limit5].[Hash] AS [Hash],
[Limit5].[IconUrl] AS [IconUrl],
[Limit5].[IsLatest] AS [IsLatest],
[Limit5].[IsLatestStable] AS [IsLatestStable],
[Limit5].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Limit5].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Limit5].[LastUpdated] AS [LastUpdated],
[Limit5].[LastEdited] AS [LastEdited],
[Limit5].[LicenseUrl] AS [LicenseUrl],
[Limit5].[HideLicenseReport] AS [HideLicenseReport],
[Limit5].[Language] AS [Language],
[Limit5].[Published] AS [Published],
[Limit5].[PackageFileSize] AS [PackageFileSize],
[Limit5].[ProjectUrl] AS [ProjectUrl],
[Limit5].[RepositoryUrl] AS [RepositoryUrl],
[Limit5].[RepositoryType] AS [RepositoryType],
[Limit5].[HasReadMe] AS [HasReadMe],
[Limit5].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Limit5].[DevelopmentDependency] AS [DevelopmentDependency],
[Limit5].[Summary] AS [Summary],
[Limit5].[Tags] AS [Tags],
[Limit5].[Title] AS [Title],
[Limit5].[Version] AS [Version],
[Limit5].[NormalizedVersion] AS [NormalizedVersion],
[Limit5].[SemVerLevelKey] AS [SemVerLevelKey],
[Limit5].[LicenseNames] AS [LicenseNames],
[Limit5].[LicenseReportUrl] AS [LicenseReportUrl],
[Limit5].[Listed] AS [Listed],
[Limit5].[IsPrerelease] AS [IsPrerelease],
[Limit5].[FlattenedAuthors] AS [FlattenedAuthors],
[Limit5].[FlattenedDependencies] AS [FlattenedDependencies],
[Limit5].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Limit5].[MinClientVersion] AS [MinClientVersion],
[Limit5].[UserKey] AS [UserKey],
[Limit5].[Deleted] AS [Deleted],
[Limit5].[PackageStatusKey] AS [PackageStatusKey],
[Limit5].[CertificateKey] AS [CertificateKey],
[Limit5].[Id] AS [Id],
[Limit5].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Limit5].[LicenseExpression] AS [LicenseExpression],
[Limit5].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Limit5].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Limit5].[PackageDelete_Key] AS [PackageDelete_Key],
[Extent23].[Key] AS [Key1],
[Extent23].[Id] AS [Id1],
[Extent23].[DownloadCount] AS [DownloadCount1],
[Extent24].[Key] AS [Key2],
[Extent24].[Id] AS [Id2],
[Extent24].[DownloadCount] AS [DownloadCount2],
[Extent24].[IsVerified] AS [IsVerified],
[Extent24].[IsLocked] AS [IsLocked],
[Extent24].[RenamedMessage] AS [RenamedMessage]
FROM (SELECT
@p__linq__0 AS [p__linq__0],
[Distinct3].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM ( SELECT DISTINCT
[Extent19].[PackageRegistrationKey] AS [PackageRegistrationKey]
FROM [dbo].[Packages] AS [Extent19]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent20]
WHERE ([Extent19].[PackageRegistrationKey] = [Extent20].[PackageRegistrationKey]) AND ([Extent20].[UserKey] = @p__linq__0)
)) AND ([Extent19].[Listed] = 1) AND (0 = [Extent19].[PackageStatusKey])
) AS [Distinct3] ) AS [Project19]
OUTER APPLY (SELECT TOP (1) [Project21].[Key] AS [Key], [Project21].[PackageRegistrationKey] AS [PackageRegistrationKey], [Project21].[Copyright] AS [Copyright], [Project21].[Created] AS [Created], [Project21].[Description] AS [Description], [Project21].[ReleaseNotes] AS [ReleaseNotes], [Project21].[DownloadCount] AS [DownloadCount], [Project21].[ExternalPackageUrl] AS [ExternalPackageUrl], [Project21].[HashAlgorithm] AS [HashAlgorithm], [Project21].[Hash] AS [Hash], [Project21].[IconUrl] AS [IconUrl], [Project21].[IsLatest] AS [IsLatest], [Project21].[IsLatestStable] AS [IsLatestStable], [Project21].[IsLatestSemVer2] AS [IsLatestSemVer2], [Project21].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2], [Project21].[LastUpdated] AS [LastUpdated], [Project21].[LastEdited] AS [LastEdited], [Project21].[LicenseUrl] AS [LicenseUrl], [Project21].[HideLicenseReport] AS [HideLicenseReport], [Project21].[Language] AS [Language], [Project21].[Published] AS [Published], [Project21].[PackageFileSize] AS [PackageFileSize], [Project21].[ProjectUrl] AS [ProjectUrl], [Project21].[RepositoryUrl] AS [RepositoryUrl], [Project21].[RepositoryType] AS [RepositoryType], [Project21].[HasReadMe] AS [HasReadMe], [Project21].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance], [Project21].[DevelopmentDependency] AS [DevelopmentDependency], [Project21].[Summary] AS [Summary], [Project21].[Tags] AS [Tags], [Project21].[Title] AS [Title], [Project21].[Version] AS [Version], [Project21].[NormalizedVersion] AS [NormalizedVersion], [Project21].[SemVerLevelKey] AS [SemVerLevelKey], [Project21].[LicenseNames] AS [LicenseNames], [Project21].[LicenseReportUrl] AS [LicenseReportUrl], [Project21].[Listed] AS [Listed], [Project21].[IsPrerelease] AS [IsPrerelease], [Project21].[FlattenedAuthors] AS [FlattenedAuthors], [Project21].[FlattenedDependencies] AS [FlattenedDependencies], [Project21].[FlattenedPackageTypes] AS [FlattenedPackageTypes], [Project21].[MinClientVersion] AS [MinClientVersion], [Project21].[UserKey] AS [UserKey], [Project21].[Deleted] AS [Deleted], [Project21].[PackageStatusKey] AS [PackageStatusKey], [Project21].[CertificateKey] AS [CertificateKey], [Project21].[Id] AS [Id], [Project21].[EmbeddedLicenseType] AS [EmbeddedLicenseType], [Project21].[LicenseExpression] AS [LicenseExpression], [Project21].[HasEmbeddedIcon] AS [HasEmbeddedIcon], [Project21].[EmbeddedReadmeType] AS [EmbeddedReadmeType], [Project21].[PackageDelete_Key] AS [PackageDelete_Key]
FROM ( SELECT
[Extent21].[Key] AS [Key],
[Extent21].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent21].[Copyright] AS [Copyright],
[Extent21].[Created] AS [Created],
[Extent21].[Description] AS [Description],
[Extent21].[ReleaseNotes] AS [ReleaseNotes],
[Extent21].[DownloadCount] AS [DownloadCount],
[Extent21].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Extent21].[HashAlgorithm] AS [HashAlgorithm],
[Extent21].[Hash] AS [Hash],
[Extent21].[IconUrl] AS [IconUrl],
[Extent21].[IsLatest] AS [IsLatest],
[Extent21].[IsLatestStable] AS [IsLatestStable],
[Extent21].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Extent21].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Extent21].[LastUpdated] AS [LastUpdated],
[Extent21].[LastEdited] AS [LastEdited],
[Extent21].[LicenseUrl] AS [LicenseUrl],
[Extent21].[HideLicenseReport] AS [HideLicenseReport],
[Extent21].[Language] AS [Language],
[Extent21].[Published] AS [Published],
[Extent21].[PackageFileSize] AS [PackageFileSize],
[Extent21].[ProjectUrl] AS [ProjectUrl],
[Extent21].[RepositoryUrl] AS [RepositoryUrl],
[Extent21].[RepositoryType] AS [RepositoryType],
[Extent21].[HasReadMe] AS [HasReadMe],
[Extent21].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Extent21].[DevelopmentDependency] AS [DevelopmentDependency],
[Extent21].[Summary] AS [Summary],
[Extent21].[Tags] AS [Tags],
[Extent21].[Title] AS [Title],
[Extent21].[Version] AS [Version],
[Extent21].[NormalizedVersion] AS [NormalizedVersion],
[Extent21].[SemVerLevelKey] AS [SemVerLevelKey],
[Extent21].[LicenseNames] AS [LicenseNames],
[Extent21].[LicenseReportUrl] AS [LicenseReportUrl],
[Extent21].[Listed] AS [Listed],
[Extent21].[IsPrerelease] AS [IsPrerelease],
[Extent21].[FlattenedAuthors] AS [FlattenedAuthors],
[Extent21].[FlattenedDependencies] AS [FlattenedDependencies],
[Extent21].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Extent21].[MinClientVersion] AS [MinClientVersion],
[Extent21].[UserKey] AS [UserKey],
[Extent21].[Deleted] AS [Deleted],
[Extent21].[PackageStatusKey] AS [PackageStatusKey],
[Extent21].[CertificateKey] AS [CertificateKey],
[Extent21].[Id] AS [Id],
[Extent21].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Extent21].[LicenseExpression] AS [LicenseExpression],
[Extent21].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Extent21].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Extent21].[PackageDelete_Key] AS [PackageDelete_Key]
FROM [dbo].[Packages] AS [Extent21]
WHERE ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[PackageRegistrationOwners] AS [Extent22]
WHERE ([Extent21].[PackageRegistrationKey] = [Extent22].[PackageRegistrationKey]) AND ([Extent22].[UserKey] = @p__linq__0)
)) AND ([Extent21].[Listed] = 1) AND (0 = [Extent21].[PackageStatusKey]) AND ([Project19].[PackageRegistrationKey] = [Extent21].[PackageRegistrationKey])
) AS [Project21]
ORDER BY [Project21].[IsLatestStableSemVer2] DESC, [Project21].[IsLatestStable] DESC, [Project21].[IsLatestSemVer2] DESC, [Project21].[IsLatest] DESC, [Project21].[Listed] DESC, [Project21].[Key] DESC ) AS [Limit5]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent23] ON [Limit5].[PackageRegistrationKey] = [Extent23].[Key]
LEFT OUTER JOIN [dbo].[PackageRegistrations] AS [Extent24] ON [Limit5].[PackageRegistrationKey] = [Extent24].[Key]
) AS [Project22]
ORDER BY row_number() OVER (ORDER BY [Project22].[DownloadCount1] DESC, [Project22].[Id1] ASC)
OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY ) AS [Limit6]
CROSS APPLY (SELECT
CASE WHEN ([Extent26].[Key] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1],
[Extent25].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent25].[Key] AS [Key],
[Extent25].[Key] AS [Key1],
[Extent25].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Extent25].[Copyright] AS [Copyright],
[Extent25].[Created] AS [Created],
[Extent25].[Description] AS [Description],
[Extent25].[ReleaseNotes] AS [ReleaseNotes],
[Extent25].[DownloadCount] AS [DownloadCount],
[Extent25].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Extent25].[HashAlgorithm] AS [HashAlgorithm],
[Extent25].[Hash] AS [Hash],
[Extent25].[IconUrl] AS [IconUrl],
[Extent25].[IsLatest] AS [IsLatest],
[Extent25].[IsLatestStable] AS [IsLatestStable],
[Extent25].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Extent25].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Extent25].[LastUpdated] AS [LastUpdated],
[Extent25].[LastEdited] AS [LastEdited],
[Extent25].[LicenseUrl] AS [LicenseUrl],
[Extent25].[HideLicenseReport] AS [HideLicenseReport],
[Extent25].[Language] AS [Language],
[Extent25].[Published] AS [Published],
[Extent25].[PackageFileSize] AS [PackageFileSize],
[Extent25].[ProjectUrl] AS [ProjectUrl],
[Extent25].[RepositoryUrl] AS [RepositoryUrl],
[Extent25].[RepositoryType] AS [RepositoryType],
[Extent25].[HasReadMe] AS [HasReadMe],
[Extent25].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Extent25].[DevelopmentDependency] AS [DevelopmentDependency],
[Extent25].[Summary] AS [Summary],
[Extent25].[Tags] AS [Tags],
[Extent25].[Title] AS [Title],
[Extent25].[Version] AS [Version],
[Extent25].[NormalizedVersion] AS [NormalizedVersion],
[Extent25].[SemVerLevelKey] AS [SemVerLevelKey],
[Extent25].[LicenseNames] AS [LicenseNames],
[Extent25].[LicenseReportUrl] AS [LicenseReportUrl],
[Extent25].[Listed] AS [Listed],
[Extent25].[IsPrerelease] AS [IsPrerelease],
[Extent25].[FlattenedAuthors] AS [FlattenedAuthors],
[Extent25].[FlattenedDependencies] AS [FlattenedDependencies],
[Extent25].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Extent25].[MinClientVersion] AS [MinClientVersion],
[Extent25].[UserKey] AS [UserKey],
[Extent25].[Deleted] AS [Deleted],
[Extent25].[PackageStatusKey] AS [PackageStatusKey],
[Extent25].[CertificateKey] AS [CertificateKey],
[Extent25].[Id] AS [Id],
[Extent25].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Extent25].[LicenseExpression] AS [LicenseExpression],
[Extent25].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Extent25].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Extent25].[PackageDelete_Key] AS [PackageDelete_Key],
[Extent26].[Key] AS [Key2],
[Extent26].[Key] AS [Key3],
[Extent26].[TargetFramework] AS [TargetFramework],
[Extent26].[Package_Key] AS [Package_Key],
CAST(NULL AS int) AS [C2],
CAST(NULL AS int) AS [C3],
CAST(NULL AS int) AS [C4],
CAST(NULL AS int) AS [C5],
CAST(NULL AS int) AS [C6],
CAST(NULL AS int) AS [C7],
CAST(NULL AS datetime2) AS [C8],
CAST(NULL AS varchar(1)) AS [C9]
FROM [dbo].[Packages] AS [Extent25]
LEFT OUTER JOIN [dbo].[PackageFrameworks] AS [Extent26] ON [Extent25].[Key] = [Extent26].[Package_Key]
WHERE [Limit6].[PackageRegistrationKey1] = [Extent25].[PackageRegistrationKey]
UNION ALL
SELECT
2 AS [C1],
[Extent27].[PackageRegistrationKey] AS [PackageRegistrationKey],
[Extent27].[Key] AS [Key],
[Extent27].[Key] AS [Key1],
[Extent27].[PackageRegistrationKey] AS [PackageRegistrationKey1],
[Extent27].[Copyright] AS [Copyright],
[Extent27].[Created] AS [Created],
[Extent27].[Description] AS [Description],
[Extent27].[ReleaseNotes] AS [ReleaseNotes],
[Extent27].[DownloadCount] AS [DownloadCount],
[Extent27].[ExternalPackageUrl] AS [ExternalPackageUrl],
[Extent27].[HashAlgorithm] AS [HashAlgorithm],
[Extent27].[Hash] AS [Hash],
[Extent27].[IconUrl] AS [IconUrl],
[Extent27].[IsLatest] AS [IsLatest],
[Extent27].[IsLatestStable] AS [IsLatestStable],
[Extent27].[IsLatestSemVer2] AS [IsLatestSemVer2],
[Extent27].[IsLatestStableSemVer2] AS [IsLatestStableSemVer2],
[Extent27].[LastUpdated] AS [LastUpdated],
[Extent27].[LastEdited] AS [LastEdited],
[Extent27].[LicenseUrl] AS [LicenseUrl],
[Extent27].[HideLicenseReport] AS [HideLicenseReport],
[Extent27].[Language] AS [Language],
[Extent27].[Published] AS [Published],
[Extent27].[PackageFileSize] AS [PackageFileSize],
[Extent27].[ProjectUrl] AS [ProjectUrl],
[Extent27].[RepositoryUrl] AS [RepositoryUrl],
[Extent27].[RepositoryType] AS [RepositoryType],
[Extent27].[HasReadMe] AS [HasReadMe],
[Extent27].[RequiresLicenseAcceptance] AS [RequiresLicenseAcceptance],
[Extent27].[DevelopmentDependency] AS [DevelopmentDependency],
[Extent27].[Summary] AS [Summary],
[Extent27].[Tags] AS [Tags],
[Extent27].[Title] AS [Title],
[Extent27].[Version] AS [Version],
[Extent27].[NormalizedVersion] AS [NormalizedVersion],
[Extent27].[SemVerLevelKey] AS [SemVerLevelKey],
[Extent27].[LicenseNames] AS [LicenseNames],
[Extent27].[LicenseReportUrl] AS [LicenseReportUrl],
[Extent27].[Listed] AS [Listed],
[Extent27].[IsPrerelease] AS [IsPrerelease],
[Extent27].[FlattenedAuthors] AS [FlattenedAuthors],
[Extent27].[FlattenedDependencies] AS [FlattenedDependencies],
[Extent27].[FlattenedPackageTypes] AS [FlattenedPackageTypes],
[Extent27].[MinClientVersion] AS [MinClientVersion],
[Extent27].[UserKey] AS [UserKey],
[Extent27].[Deleted] AS [Deleted],
[Extent27].[PackageStatusKey] AS [PackageStatusKey],
[Extent27].[CertificateKey] AS [CertificateKey],
[Extent27].[Id] AS [Id],
[Extent27].[EmbeddedLicenseType] AS [EmbeddedLicenseType],
[Extent27].[LicenseExpression] AS [LicenseExpression],
[Extent27].[HasEmbeddedIcon] AS [HasEmbeddedIcon],
[Extent27].[EmbeddedReadmeType] AS [EmbeddedReadmeType],
[Extent27].[PackageDelete_Key] AS [PackageDelete_Key],
CAST(NULL AS int) AS [C2],
CAST(NULL AS int) AS [C3],
CAST(NULL AS varchar(1)) AS [C4],
CAST(NULL AS int) AS [C5],
[Extent28].[Key] AS [Key2],
[Extent28].[PackageKey] AS [PackageKey],
[Extent28].[Status] AS [Status],
[Extent28].[AlternatePackageRegistrationKey] AS [AlternatePackageRegistrationKey],
[Extent28].[AlternatePackageKey] AS [AlternatePackageKey],
[Extent28].[DeprecatedByUserKey] AS [DeprecatedByUserKey],
[Extent28].[DeprecatedOn] AS [DeprecatedOn],
[Extent28].[CustomMessage] AS [CustomMessage]
FROM [dbo].[Packages] AS [Extent27]
INNER JOIN [dbo].[PackageDeprecations] AS [Extent28] ON [Extent27].[Key] = [Extent28].[PackageKey]
WHERE [Limit6].[PackageRegistrationKey1] = [Extent27].[PackageRegistrationKey]) AS [UnionAll2]) AS [UnionAll3]
ORDER BY [UnionAll3].[DownloadCount] DESC, [UnionAll3].[Id] ASC, [UnionAll3].[PackageRegistrationKey] ASC, [UnionAll3].[Key] ASC, [UnionAll3].[Key1] ASC, [UnionAll3].[Key3] ASC, [UnionAll3].[C1] ASC, [UnionAll3].[C19] ASC, [UnionAll3].[C21] ASC, [UnionAll3].[C73] ASCI am not sure if the SQL-based approach is really the best. I think using the Search Service might be better, since it is already factored to support the list view (shared between package search and the profile page). It has the frameworks denormalized into the search documents and the "Is latest SemVer2" baked into the search index schema. What do you think? |
|
@joelverhagen Let me have another look, I think that the change to do paging opens some opportunities I did not take advantage of. |
|
@ErikEJ, sounds good. Next time around, let's have the new code path wrapped in feature flag (runtime on/off switch) or flight (same as feature flag but can be user scoped). That way I can enable it and disable it in PROD without a rollback. Here's a sample usage: Here's a flight: |
Sure! I found the regression, and will push a new PR (and add feature flag) once the dev branch has been updated with the revert. |
|
Check the release date in the html source - I suspect it is not deployed yet. |
…to 2 (NuGet#10411)" (NuGet#10433) This reverts commit 24d69cd.
* Add computed observables for deprecation reasons Updated `page-manage-deprecation.js` to include new computed observables: `chosenItemsHasUndeprecatedVersion` and `chosenItemsHasDeprecatedVersion`. Introduced observable properties for `isLegacy`, `hasCriticalBugs`, and `isOther` to track deprecation reasons. Modified `_ManageDeprecation.cshtml` to display alerts based on these properties and ensure proper binding for checkbox inputs. * Fixed white space issues. * Fixed typos. * Remove trailing CR/LF from files. * Add computed observables for deprecation reasons Updated `page-manage-deprecation.js` to include new computed observables: `chosenItemsHasUndeprecatedVersion` and `chosenItemsHasDeprecatedVersion`. Introduced observable properties for `isLegacy`, `hasCriticalBugs`, and `isOther` to track deprecation reasons. Modified `_ManageDeprecation.cshtml` to display alerts based on these properties and ensure proper binding for checkbox inputs. * Update sign.thirdparty.props for ApiKeyV5 change (#10373) * Fix guardian false positive (#10399) * Fix * Fix2 * Final changes * Update RemovedPackages.md * [HotFix] Temporary limit to ascii only (#10409) Temporary allow ascii only * [HotFix]: Fix double encoding (#10417) * [HotFix]: Fix base address and blob uri decoding mismatch (#10429) * BUG: 10341 - Proper Display of License Information (#10383) * BUG: 10341 - Proper Display of License Information - Added `IsLicense` and `IsException` methods to improve license checking. - Introduced `MakeExceptionLink` and `MakePlainSpan` helpers .- Updated rendering logic for license links using new methods. * Undo whitespace --------- Co-authored-by: Joel Verhagen <jver@microsoft.com> * Exclude the source repo as dependent repo (#10347) * Cache top 6 popluar repos to exclude the repo itself if any * Add ComparableGitHubRepository to DisplayPackageViewModel * Compare Repos Id with ComparableGitHubRepository * Apply code suggestions * Fix total and top counts when excluding --------- Co-authored-by: Ruijie Shi <ruishi@microsoft.com> Co-authored-by: Joel Verhagen <jver@microsoft.com> * Disabling TRACE method functional tests (#10391) * Setup for running functional tests locally. * Printing URL * Not testing TRACE requests. * Change "Up for grabs" to "good first issue" (#10395) I noticed, that the "up for grabs" label was removed and the best fit seems to be "good first issue". Co-authored-by: Maria Ghiondea <11394867+mariaghiondea@users.noreply.github.com> * Do not call GetProperties on a blob when metadata is available via enumeration (#10400) * updating script render format to include Nonce * continued work with csp implementation * removed unwanted lines and update webconfig value * Update src/NuGetGallery/App_Code/ViewHelpers.cshtml Co-authored-by: lyndaidaii <64443925+lyndaidaii@users.noreply.github.com> * PR related changes * removed unwanted whitespaces * additional changes not included earlier * updated from obsolete crypto API use, added nonce to cookie compliance script * Make CSP header readable and remove whitespaces * more whitespace undoing * PR changes. Also included file hashes * Update src/NuGetGallery/Web.config Co-authored-by: lyndaidaii <64443925+lyndaidaii@users.noreply.github.com> * Remove spackage upload submit dropdown (#10393) * Change profile section aria label (#10384) * change API key edit button text (#10379) * Add learn more link to Framework legend (#10389) * [OIDC 17] Add token API for trading bearer token for API key (#10308) * [OIDC] Add token API for trading bearer token for API key * Add hard enable/disable switch for the token api controller * Use camelCase like our other JSON APIs * Make localhost certificate longer listed, warn about machine reboot (#10413) * Add support for markdown > alerts via markdig (#10173) Add support for markdown > alerts via markdig * Reduce database calls for Microsoft profile page from 21.056 to 2 (#10411) * Adding .NET 10 support to TFM search (#10408) * Temporary change * Changes * Undoind some changes * Undoing more changes * Undoing changes pt 3 * Log the Azure search request-id to help future debugging (#10419) Help debug https://github.com/NuGet/Engineering/issues/5075 * Handle 404 exceptions in StatusAggregator (#10430) * [Hotfix] Fix broken unit test blocking hotifx (#10434) * Revert "Reduce database calls for Microsoft profile page from 21.056 to 2 (#10411)" (#10433) This reverts commit 24d69cd. * Reduce database calls for Microsoft profile page from 21.056 to 42 (#10443) * Add copilot instructions for Visual Studio (#10394) * Upgrade Microsoft.Identity.Web to 3.8.2 (#10420) * Compile styles for changes made in upload.less file. (#10444) * update IP package version (#10446) * Fixed white space issues. * Fixed typos. * Remove trailing CR/LF from files. * Restored HTML that was accidentally removed. * Added helper function to eliminate duplicate code. * Resolve Conflict with Twitter / X anchor * Resolve indentation conflict * Resolve indentation conflict * Copied lines directly from dev branch to fix conflct * Add form control that was accidentally removed. Removed duplicate info messages that were added as a result of the managing merge conflicts. * Fixed twitter/x conflict * Fixed spacing again * Trying to resolve conflict * One more try. * One more try * Revert unrelated changes from merge * Reword since versions are selected --------- Co-authored-by: Joel Verhagen <jver@microsoft.com> Co-authored-by: Lanaparezanin <58230697+Lanaparezanin@users.noreply.github.com> Co-authored-by: v-sulagnapal <165667801+v-sulagnapal@users.noreply.github.com> Co-authored-by: Erick Yondon <8766776+erdembayar@users.noreply.github.com> Co-authored-by: ericstone93 <151231344+ericstone93@users.noreply.github.com> Co-authored-by: Ruijie Shi <ruishi@microsoft.com> Co-authored-by: Andrei Grigorev <angrigor@microsoft.com> Co-authored-by: Robert Muehsig <robert.muehsig@codeinside.eu> Co-authored-by: Maria Ghiondea <11394867+mariaghiondea@users.noreply.github.com> Co-authored-by: Miracle Aduku <56966553+enema17484@users.noreply.github.com> Co-authored-by: lyndaidaii <64443925+lyndaidaii@users.noreply.github.com> Co-authored-by: Lili Xie <v-xielili@microsoft.com> Co-authored-by: Daniel Cazzulino <daniel@cazzulino.com> Co-authored-by: Erik Ejlskov Jensen <ErikEJ@users.noreply.github.com> Co-authored-by: Advay Tandon <82980589+advay26@users.noreply.github.com> Co-authored-by: Tony Q. <tonyqus@gmail.com> Co-authored-by: Ryu Yu <11051729+ryuyu@users.noreply.github.com>



Summary of the changes (in less than 80 characters):
Addresses #10221 (partly)
fixes #5877
fixes #5659
fixes #10025
Details
After following the contribution guide for local deveoplement, I created a crude .NET 8 console app using EF Core 8 with EF Core Power Tools CLI and NuGet.CatalogReader to populate my database with meta data based on some production .nuspec files.
I could then test a profile with 59 packages, and noticed that the following two queries were executed for each of the 59 packages:
This was due to lazy loading kicking in... (Maybe you should consider disabling that?)
With the code changes, these related tables are now eager loaded in a single database roundtrip.