Base solution for your next web application

Activities of "jfbaudracco"

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

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

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

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

Hi,

I found the origin of my problem. I had to add :

Configuration.ReplaceService<IEfTransactionStrategy, DbContextEfTransactionStrategy>(DependencyLifeStyle.Transient);

in my DataModule. In one of the domain service methods called by the application service method, SaveChangesAsync is invoqued. And, it seems that the transactions are not shared with Ef.

I do not known if the analyse and solutions are corrects. What do you think about that ?

Thank you, Jean-François

Hi,

I don't understand why in the code bellow, the lazing loading (envelope.Sending.SenderId) use a different connection (spid) and this is used until the end of method. So the first GetAsync, begin a transaction with a spid, and the following code, who execute SaveChanges in domain service method, do it with different spid, in a different context. When an exception is raised, the roolback is done for the first context and the SaveChanges is not rolled back.

Someone can help me ? Thank you

/// <summary>
        /// <see cref="ISendingAppService.ConfirmEnvelope(ConfirmEnvelopeInput)"/>.
        /// </summary>
        public async Task ConfirmEnvelope(ConfirmEnvelopeInput input)
        {
            var envelope = await _envelopeRepository.GetAsync(input.Id);

            // Vérification des droits de l'utilisateur qui sollicite la confirmation.
            var permissionName = AppPermissions.Operations_Payslips_Approve; // TODO: implémenter un mécanisme de détermination de l'autorisation en fonction du type d'envoi auquel le pli confirmé est associé.
            if (!(await IsGrantedAsync(envelope.Sending.SenderId.Value, permissionName)))
                throw new AbpAuthorizationException();

            await _sendingManager.ConfirmEnvelopeAsync(envelope);

            if (!input.DemoEmailAddress.IsNullOrWhiteSpace())
                await _envelopeDataRepository.InsertAsync(new EnvelopeData(envelope.Id, EnvelopeDataNames.Demo.EmailAddress, input.DemoEmailAddress));
        }
Showing 1 to 6 of 6 entries