ABP Framework version: v5.3.4
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes Im trying custom create user by admin in abp,so override createAsync in IdentityUserAppService,but this part of code not executed
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IIdentityUserAppService))]
public class CustomIdentityUserAppService : IdentityUserAppService
{
#region DI
private readonly IContactDapperRepository _contactDapperRepository;
public CustomIdentityUserAppService(IdentityUserManager userManager, IIdentityUserRepository userRepository, IIdentityRoleRepository roleRepository, IOrganizationUnitRepository organizationUnitRepository, IIdentityClaimTypeRepository identityClaimTypeRepository, IdentityProTwoFactorManager identityProTwoFactorManager, IOptions<IdentityOptions> identityOptions, IDistributedEventBus distributedEventBus, IOptions<AbpIdentityOptions> abpIdentityOptions, IContactDapperRepository contactDapperRepository) : base(userManager, userRepository, roleRepository, organizationUnitRepository,identityClaimTypeRepository, identityProTwoFactorManager, identityOptions, distributedEventBus, abpIdentityOptions)
{
_contactDapperRepository = contactDapperRepository;
}
#endregion
public override async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
var x = await base.CreateAsync(input);
var userContactId = CurrentUser.GetContactId().ToInt().GetValueOrDefault();
var userSessionId = CurrentUser.GetUserSessionId().ToInt();
var contactId = await _contactDapperRepository.CreateUserAsync(input, null, userContactId, userSessionId);
return x;
}
i try this
[ExposeServices( typeof(IIdentityUserAppService), typeof(IdentityUserAppService), typeof(CustomIdentityUserAppService))]
and this too
[ExposeServices(typeof(CustomIdentityUserAppService), typeof(IIdentityUserAppService), typeof(IdentityUserAppService))]
but not working yet
9 Answer(s)
-
0
Can you try this way?
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
-
0
Can you try this way?
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
I try this but override createAsync in IdentityUserAppService not executed
-
0
-
0
-
0
I fixed the return type but result not changed, your version is : v5.3.4? because as i see your constructor inputs are not same as i. for example you dont have distributedEventBus as input for constructor
I tested it with MVC as it is a backend. That's why it's missing. Now I've created it with Angular. The command I use to create the project is:
abp new Qa4641 --version 5.3.4 -u angular
-
0
I fixed the return type but result not changed,
your version is : v5.3.4? because as i see your constructor inputs are not same as i.
for example you dont have distributedEventBus as input for constructorI tested it with MVC as it is a backend. That's why it's missing. Now I've created it with Angular. https://github.com/salihozkara/Qa4641/commit/17ea6c5e26a85f59580647cd444403794f93313b https://github.com/salihozkara/Qa4641/blob/master/aspnet-core/src/Qa4641.Domain.Shared/Qa4641.Domain.Shared.csproj#L19 The command I use to create the project is:
abp new Qa4641 --version 5.3.4 -u angular
I write the same code as you but my override method not executed.do u have any idea why this happen?
-
0
Hello, are you trying to add a user from the admin page or to register? This code is working to add user from admin page. Can you create and share a project that doesn't work using this method? You can create a private repository on Github and authorize me.(https://github.com/salihozkara)
-
0
Hello, are you trying to add a user from the admin page or to register? This code is working to add user from admin page. Can you create and share a project that doesn't work using this method? You can create a private repository on Github and authorize me.(https://github.com/salihozkara)
I solved the problem . I moved class from identityServer project to the HttpApi.Host Project and problem Solved.
-
0
I'm closing the question.