You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to put [DisableValidation] to CreateAsync in both Controller and AppService, it still does not work.
if the Password field has value, it hits the method -> the override is succesfully
if the Password is null/empty, the validation is triggered -> the [DisableValidation] is not working
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IdentityUserController))]
public class CustomIdentityUserController : IdentityUserController
{
public CustomIdentityUserController(IIdentityUserAppService userAppService) : base(userAppService)
{
}
[DisableValidation]
public override Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
return UserAppService.CreateAsync(input);
}
}
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IdentityUserAppService))]
public class CustomIdentityUserAppService : IdentityUserAppService
{
public CustomIdentityUserAppService(
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IIdentityRoleRepository roleRepository,
IOrganizationUnitRepository organizationUnitRepository,
IIdentityClaimTypeRepository identityClaimTypeRepository,
IdentityTwoFactorManager identityTwoFactorManager
) : base(userManager,
userRepository,
roleRepository,
organizationUnitRepository,
identityClaimTypeRepository,
identityTwoFactorManager)
{
}
[DisableValidation]
public override async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
var user = new IdentityUser(
GuidGenerator.Create(),
input.UserName,
input.Email,
CurrentTenant.Id
);
input.MapExtraPropertiesTo(user);
(await UserManager.CreateAsync(user)).CheckErrors();
await UpdateUserByInput(user, input);
await CurrentUnitOfWork.SaveChangesAsync();
var userDto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
return userDto;
}
}
The text was updated successfully, but these errors were encountered:
Reported at https://support.abp.io/QA/Questions/1340/How-to-removedisable-validation-for-existing-DTO-object
The text was updated successfully, but these errors were encountered: