Hi,
Since v3.4.0 upgrade, GetMenuAsync queries AbpUsers several times. I catch the below query from sql profiler when GetMenuAsync is invoked. Like if these queries are executed for each menu item definition. So, GetScripts produces the same calls.
exec sp_executesql N'SELECT TOP (1) [Extent1].[Id] AS [Id], [Extent1].[ProfilePictureId] AS [ProfilePictureId], [Extent1].[ShouldChangePasswordOnNextLogin] AS [ShouldChangePasswordOnNextLogin], [Extent1].[Gender] AS [Gender], [Extent1].[ShouldChangeEmailOnNextLogin] AS [ShouldChangeEmailOnNextLogin], [Extent1].[TermsOfServiceAccepted] AS [TermsOfServiceAccepted], [Extent1].[SecurityCode] AS [SecurityCode], [Extent1].[AuthenticationSource] AS [AuthenticationSource], [Extent1].[Name] AS [Name], [Extent1].[Surname] AS [Surname], [Extent1].[Password] AS [Password], [Extent1].[IsEmailConfirmed] AS [IsEmailConfirmed], [Extent1].[EmailConfirmationCode] AS [EmailConfirmationCode], [Extent1].[PasswordResetCode] AS [PasswordResetCode], [Extent1].[LockoutEndDateUtc] AS [LockoutEndDateUtc], [Extent1].[AccessFailedCount] AS [AccessFailedCount], [Extent1].[IsLockoutEnabled] AS [IsLockoutEnabled], [Extent1].[PhoneNumber] AS [PhoneNumber], [Extent1].[IsPhoneNumberConfirmed] AS [IsPhoneNumberConfirmed], [Extent1].[SecurityStamp] AS [SecurityStamp], [Extent1].[IsTwoFactorEnabled] AS [IsTwoFactorEnabled], [Extent1].[IsActive] AS [IsActive], [Extent1].[UserName] AS [UserName], [Extent1].[TenantId] AS [TenantId], [Extent1].[EmailAddress] AS [EmailAddress], [Extent1].[LastLoginTime] AS [LastLoginTime], [Extent1].[IsDeleted] AS [IsDeleted], [Extent1].[DeleterUserId] AS [DeleterUserId], [Extent1].[DeletionTime] AS [DeletionTime], [Extent1].[LastModificationTime] AS [LastModificationTime], [Extent1].[LastModifierUserId] AS [LastModifierUserId], [Extent1].[CreationTime] AS [CreationTime], [Extent1].[CreatorUserId] AS [CreatorUserId] FROM [dbo].[AbpUsers] AS [Extent1] WHERE ((([Extent1].[TenantId] IS NULL) AND (@DynamicFilterParam_000001 IS NULL)) OR (([Extent1].[TenantId] IS NOT NULL) AND ([Extent1].[TenantId] = @DynamicFilterParam_000001)) ) AND (([Extent1].[IsDeleted] = @DynamicFilterParam_000003) ) AND (1 = [Extent1].[Id])',N'@DynamicFilterParam_000001 int,@DynamicFilterParam_000002 bit,@DynamicFilterParam_000003 bit,@DynamicFilterParam_000004 bit',@DynamicFilterParam_000001=NULL,@DynamicFilterParam_000002=NULL,@DynamicFilterParam_000003=0,@DynamicFilterParam_000004=NULL
Thank you, Jean-François
5 Answer(s)
-
0
To complete,
I found that is because since ABP v 1.5.1, AbpUserManager.IsGrantedAsync include a supplementary test :
//User not found if (await FindByIdAsync(userId) == null) { return false; }
I'm sure is a necessary test, but multiples IsGrantedAsync calls in a loop produce multiples queries that in this context are not required !
Thank you, JF
-
0
Me again,
Perhaps, the user test can be do after verifying if the cache permissions does not already contain an entry for the userId !
JF
-
0
Hi,
Thank you for your finding. Can you create an issue <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues">https://github.com/aspnetboilerplate/module-zero/issues</a>.
Thanks.
-
0
Hi,
It is done : <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/336">https://github.com/aspnetboilerplate/mo ... issues/336</a>
Thank you
-
0
Hi,
Thanks, we will consider this in a short time.
Thanks again.