Hi,
After going through ABP's extensive Extra Properties feature, I still don't see how we can use it to map some obvious properties like Name
and Surname
during registration without modifying module code. In provided AccountAppService.RegisterAsync
the extra properties are mapped like this:
input.MapExtraPropertiesTo(user);
So even after adding Name
and Surname
as extra properties to RegisterDto
those properties will not get mapped to the IdentityUser
object.
Only option to avoid modifying source code seems to be to override the AccountAppService
by calling the base method, map add'l properties after create, and do a follow up UserManager.UpdateAsync
.
public override async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
{
var baseResult = await base.RegisterAsync(input);
// Handle extra properties
var user = await UserManager.GetByIdAsync(baseResult.Id);
user.Surname = input.GetSurname();
user.Name = input.GetName();
await UserManager.UpdateAsync(user);
var result = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
return result;
}
It would be nice if there was a way to make MapExtraPropertiesTo
extension method also map to regular properties. After checking the source, it seems that this is only possible using AutoMapper MapExtraProperties
which would still require modifying module source code.
Thoughts?
Hi,
We are looking to enable external social logins in the React Native app. Taking Google sign-in for example, what would be the general approach in enabling this in the mobile app?