Hi,
please use below code in a new project.
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Caching;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Identity;
using Volo.Abp.Threading;
namespace Test.Identity;
public class MyIdentityUserAppService : IdentityUserAppService
{
public MyIdentityUserAppService(
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IIdentityRoleRepository roleRepository,
IOrganizationUnitRepository organizationUnitRepository,
IIdentityClaimTypeRepository claimTypeRepository,
IdentityProTwoFactorManager twoFactorManager,
IOptions<IdentityOptions> identityOptions,
IDistributedEventBus eventBus,
IOptions<AbpIdentityOptions> abpIdentityOptions,
IPermissionChecker permissionChecker,
IDistributedCache<IdentityUserDownloadTokenCacheItem, string> userDownloadTokenCache,
IDistributedCache<ImportInvalidUsersCacheItem, string> importInvalidUsersCache,
IdentitySessionManager sessionManager,
IdentityUserTwoFactorChecker userTwoFactorChecker,
ICancellationTokenProvider cancellationTokenProvider)
: base(
userManager,
userRepository,
roleRepository,
organizationUnitRepository,
claimTypeRepository,
twoFactorManager,
identityOptions,
eventBus,
abpIdentityOptions,
permissionChecker,
userDownloadTokenCache,
importInvalidUsersCache,
sessionManager,
userTwoFactorChecker,
cancellationTokenProvider)
{
}
public async Task<PagedResultDto<LookupDto<Guid>>> GetDummy(LookupRequestDto input)
{
var users = await UserRepository.GetListAsync();
var items = users.Select(ObjectMapper.Map<IdentityUser, LookupDto<Guid>>)
.OrderBy(u => u.DisplayName)
.ToList();
return new PagedResultDto<LookupDto<Guid>>(items.Count, items);
}
}
See below AutoMapper configuration below:
CreateMap<IdentityUser, LookupDto<Guid>>()
.ForMember(
d => d.DisplayName,
m => m.MapFrom(s =>
s.Name + " " +
s.Surname + " (" +
s.UserName + ")"));
Thanks, S.
Hi,
After upgrading our project from ABP 9.3.7 to ABP 10.1.1, we regenerated the Angular proxies and encountered a TypeScript compilation error.
Environment
ABP Framework: 10.1.1
Angular: 21.2.3
ABP CLI: 2.2.1
Issue
After generating the proxy models, the Angular build fails with the following error:
TS2430: Interface 'GetIdentityUsersInput' incorrectly extends interface 'ExtensiblePagedAndSortedResultRequestDto'.
Types of property 'id' are incompatible.
Type 'string | null | undefined' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'. [plugin angular-compiler]
src/app/proxy/volo/abp/identity/models.ts:39:17
39 │ export interface GetIdentityUsersInput extends ExtensiblePagedAndSortedResultRequestDto
The generated proxy interface is:
export interface GetIdentityUsersInput extends ExtensiblePagedAndSortedResultRequestDto {
filter?: string;
roleId?: string | null;
organizationUnitId?: string | null;
id?: string | null;
userName?: string;
}
However, ExtensiblePagedAndSortedResultRequestDto defines the id property as:
id?: string;
Because of this, TypeScript reports that the child interface is widening the type (string | null), which is not compatible with the base interface (string).
Thanks.
Hi,
After upgrading our project from ABP Framework v9.3.7 to v10.1.1, we kept AutoMapper as our object mapping solution instead of the new default Mapperly.
We configured AutoMapper in our application module as follows:
public class MyApplicationModule : AbpModule
{
}
Inside ConfigureServices:
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<MyApplicationModule>();
});
Our AutoMapper profiles are discovered correctly, and mapping works as expected in our custom application services.
For example, mapping works without issues in:
public class MyCustomAppService : MyProjectAppService, IMyCustomAppService
However, when using the same mappings inside a service that derives from the ABP identity service:
public class MyProjectIdentityUserAppService : IdentityUserAppService
we receive an exception during execution. The exception indicates that the framework is attempting to resolve a mapping using Mapperly, even though AutoMapper is configured and working elsewhere in the application.
This suggests that the IdentityUserAppService (or the underlying object mapper context) is still trying to use Mapperly instead of AutoMapper after the upgrade.
Observed behavior:
Expected behavior: Since AutoMapper is configured in the application module and works in other services, we would expect the same AutoMapper configuration to be used when extending IdentityUserAppService.
Is there an additional configuration required in ABP v10.1.1 to ensure that IdentityUserAppService uses AutoMapper instead of Mapperly? Or is there a recommended approach for overriding the object mapper context in services derived from IdentityUserAppService?
Any guidance on the correct configuration for using AutoMapper in this scenario would be appreciated.
Thanks.
[sserestyen] said:
[sserestyen] said:
Hi,
I don't have any CronExpression in my project, apart from the ones which comes with the pro packages.
As I don't have access to its source code I cannot verify those.
What kind of workers and cron expressions do we have with the pro packages?
Thanks.
Hi,
I came across with related support tickets, and found that ExpiredAuditLogDeleterOptions can be configured.
But, even though I change its default CronExpression ("0 23 * * *") to below, which should be valid for Quartz, I still get the same exception.
Configure<ExpiredAuditLogDeleterOptions>(options =>
{
options.CronExpression = "0 0 23 ? * * *";
});
Could you advise what else needs to be change to work with Quartz?
Thanks.
Hi,
Just an update, I was able to get around it. It turns out that I needed to apply both of below settings, as their default values were not compatible with Quartz.
Configure<ExpiredAuditLogDeleterOptions>(options => { options.CronExpression = "0 0 23 ? * * *"; });
Configure<AuditLogExcelFileOptions>(options => { options.ExcelFileCleanupOptions.CronExpression = "0 0 23 ? * * *"; });
Based on the documentation those original values are not compatible with Quartz https://abp.io/docs/latest/modules/audit-logging-pro#expiredauditlogdeleteroptions
Also, the below is not correct on the documentation
options.ExcelFileCleanupOptions.CronExpression = "0 23 * * *"; // Quartz Cron expression is "0 23 * * * ?"
The original cron is "0 23 * * *", which is "every day at 23:00", but Quartz Cron expression is "0 23 * * * ?" would mean every hour 23 mins. The correct configuration for Quartz Cron Expression is "0 0 23 ? * * *", which is identical with the original config.
Could this be highlighted in the documentation of Quartz integration?
Thanks.
[sserestyen] said: Hi,
I don't have any CronExpression in my project, apart from the ones which comes with the pro packages.
As I don't have access to its source code I cannot verify those.
What kind of workers and cron expressions do we have with the pro packages?
Thanks.
Hi,
I came across with related support tickets, and found that ExpiredAuditLogDeleterOptions can be configured. But, even though I change its default CronExpression ("0 23 * * *") to below, which should be valid for Quartz, I still get the same exception.
Configure<ExpiredAuditLogDeleterOptions>(options => { options.CronExpression = "0 0 23 ? * * *"; });
Could you advise what else needs to be change to work with Quartz?
Thanks.
Hi,
I don't have any CronExpression in my project, apart from the ones which comes with the pro packages. As I don't have access to its source code I cannot verify those.
What kind of workers and cron expressions do we have with the pro packages?
Thanks.
Hi,
I use the commercial license with version 9.3.7.
I wanted to add the Quartz integration following the documentation https://abp.io/docs/latest/framework/infrastructure/background-workers/quartz
I run below command to add the Quartz integration to the HttpApi.Host project
abp add-package Volo.Abp.BackgroundWorkers.Quartz
I also have added below as a dependency for HttpApiHostModule
typeof(AbpBackgroundWorkersQuartzModule)
After these when I run the project, I get below exception during application start:
Host terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AuditLogging.AbpAuditLoggingApplicationModule, Volo.Abp.AuditLogging.Application, Version=9.3.7.0, Culture=neutral, PublicKeyToken=null: Unexpected end of expression.. See the inner exception for details. ---> System.FormatException: Unexpected end of expression. at Quartz.CronExpression.BuildExpression(String expression) at Quartz.CronExpression..ctor(String cronExpression) at Quartz.CronExpression.ValidateExpression(String cronExpression) at Quartz.CronScheduleBuilder.CronSchedule(String cronExpression) at Quartz.CronScheduleTriggerBuilderExtensions.WithCronSchedule(TriggerBuilder triggerBuilder, String cronExpression) at Volo.Abp.BackgroundWorkers.Quartz.QuartzPeriodicBackgroundWorkerAdapter1.BuildWorker(IBackgroundWorker worker)
at Volo.Abp.BackgroundWorkers.Quartz.QuartzBackgroundWorkerManager.ReScheduleJobAsync(IBackgroundWorker worker, CancellationToken cancellationToken)
at Volo.Abp.BackgroundWorkers.Quartz.QuartzBackgroundWorkerManager.AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken)
at Volo.Abp.AuditLogging.AbpAuditLoggingApplicationModule.OnApplicationInitializationAsync(ApplicationInitializationContext context)
at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.InitializeAsync(ApplicationInitializationContext context, IAbpModule module)
at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context)
--- End of inner exception stack trace ---
at Volo.Abp.Modularity.ModuleManager.InitializeModulesAsync(ApplicationInitializationContext context)
at Volo.Abp.AbpApplicationBase.InitializeModulesAsync()
at Volo.Abp.AbpApplicationWithExternalServiceProvider.InitializeAsync(IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplicationAsync(IApplicationBuilder app)`
As I understand, there is a cron expression somewhere in the AbpAuditLoggingApplicationModule, which is not valid for Quartz, but I do not have access to the pro version of the source code, therefore could not verify that.
Could you advise which configuration needs to be changed to get this running?
Thanks,.
Hi,
Updating the project to 9.3.7. resolved the issue for setting the LastModificationTime value when only a foreign key is updated on the entity.
Thanks for your support.
[maliming] said: hi
I confirmed that the abp >= 9.3.7 will fix it.
https://github.com/abpframework/abp/pull/24104
Thanks
Hi,
Thanks for confirming the version with the fix included. We'll update the ABP packages to get that patch.
Thanks.